0

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()
0

1 Answer 1

0

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.

enter image description here

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()
Sign up to request clarification or add additional context in comments.

3 Comments

I don't get the popup window but thank you anyway.
Do you see any error in the console? If yes, please share it in your question.
No error. Just close Firefox Webdrive. Only, Debug last line "WebDriverWait(driver, 5).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="index-select"]/div[2]/div/div/div[6]'))).click()". Hoop close Firefox webdrive.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.