Reputation: 1
I want to scrap investing.com website. Firefox Webdriver closes when clicking on one of the dropdown list item. Dropdown menu is hiidden. I want to choose "BİST Ulusal Tüm" item. What can i do?
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium import webdriver
driver = webdriver.Firefox()
url = "https://tr.investing.com/equities/turkey"
driver.get(url)
driver.implicitly_wait(5)
WebDriverWait(driver, 1).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="index-select"]'))).click()
WebDriverWait(driver, 5).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="index-select"]/div[2]/div/div/div[6]'))).click()
Upvotes: 0
Views: 29
Reputation: 8563
After you launch the URL and open the application, below pop-up appears, you need to get rid of it first, after that try to perform the other actions.
Just add below line:
driver.implicitly_wait(5)
# Click on I Accept button
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, "onetrust-accept-btn-handler"))).click()
Upvotes: 0