(Apr-14-2022, 09:06 AM)kingoman123 Wrote: - Have some experience with java, but not with python, yet...If want doing stuff like this most learn web-scraping in Python eg look at Web-Scraping part-1
kingoman123 Wrote Wrote:What if my task is as following:The price is generated bye JavaScript,so most use other tool like Selenium.
To give example as the site is not easy as also most click on a couple of buttons then it generate the price.
from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.by import By import time #--| Setup options = Options() #options.add_argument("--headless") ser = Service(r"C:\cmder\bin\chromedriver.exe") browser = webdriver.Chrome(service=ser, options=options) #--| Parse or automation browser.get("https://www.ditur.dk/dissing-mk9-black-friday-limited-edition-d1456?linktoken=xFXOjSAR3FTGeEVN") accept_button = browser.find_element(By.CSS_SELECTOR, 'button.coi-banner__accept') accept_button.click() close_button = browser.find_element(By.CSS_SELECTOR, 'div.fancybox-overlay.fancybox-overlay-fixed.ajaxcart-modal--overlay > div > div > a') close_button.click() time.sleep(5) price = browser.find_element(By.CSS_SELECTOR, 'div.jataktilbud--price') print(price.text)
Output:799 kr
Look at this Thread for setup in Selenium v4.