0

I am trying to get data from this site: https://marketsmithindia.com/mstool/evaluation.jsp#details/symbol/VIDHIING

Once I open the page in Selenium it pops up the "Updated Privacy Policy" window. I tried using wait on the modal and click on it but it just times out. Here's the code I have tried:

click_button_path = "//[@class='modal-footer gdpr-notification-close']/[@class=''btn-primary']"
wait = WebDriverWait(driver, 10)
click_button = wait.until(EC.visibility_of_element_located((By.XPATH, click_button_path)))
click_button.click()
Nona Shah
  • 79
  • 1
  • 10

1 Answers1

0

Later I figured that the accept button is stored as cookie and doesn't load once accepted. So I found a roundabout way. I saved the cookie using Eduard's answer here: How to save and load cookies using Python + Selenium WebDriver

 # You need to: from selenium.webdriver.chrome.options import Options    
chrome_options = Options()
chrome_options.add_argument("user-data-dir=selenium") 
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get("www.google.com") # Now you can see the cookies, the settings, extensions, etc., and the logins done in the previous session are present here. 

This isn't perfect but solves my issue.

Nona Shah
  • 79
  • 1
  • 10