I am having issues locating button and clicking on it. It is pop up in internet explorer. I am using by classname but don't work.
browser.find_element_by_css_selector("ui-button ui-corner-all ui-widget").click()
HTML:
I am having issues locating button and clicking on it. It is pop up in internet explorer. I am using by classname but don't work.
browser.find_element_by_css_selector("ui-button ui-corner-all ui-widget").click()
HTML:
To locate and click the element with text as Accept you need to induce WebDriverWait for the element to be clickable and you can use either of the following Locator Strategies:
Using CSS_SELECTOR
:
WebDriverWait(browser, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "div.ui-dialog-buttonset>button.ui-button.ui-corner-all.ui-widget"))).click()
Using XPATH
:
WebDriverWait(browser, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[@class='ui-dialog-buttonset']//button[@class='ui-button ui-corner-all ui-widget' and text()='Accept']"))).click()
Note : You have to add the following imports :
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC