I try to parse this site with chromedriver But there's a dialog box that messes up with that
Is there a way to discard the dialog box or choose the No, thanks button?
I try to parse this site with chromedriver But there's a dialog box that messes up with that
Is there a way to discard the dialog box or choose the No, thanks button?
To click()on the element with text as No, thanks you have to induce WebDriverWait for the desired element_to_be_clickable() and you can use either of the following Locator Strategies:
CSS_SELECTOR:
driver.get("https://www2.sgx.com/derivatives/delayed-prices-futures?cc=CN&category=equityindex")
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "button.sgx-button--link[data-action='cancel'][data-analytics-action='Click Cancel']"))).click()
XPATH:
driver.get("https://www2.sgx.com/derivatives/delayed-prices-futures?cc=CN&category=equityindex")
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//button[@class='sgx-button--link' and @data-action='cancel'][@data-analytics-action='Click Cancel']"))).click()
Browser Snapshot: