Unable to automate ...
Notifications
Clear all

Unable to automate the click of a button in Selenium with Python

RSS

(@ganesh)
Noble Member
Joined: 2 years ago
Posts: 1362
10/05/2021 11:14 am

I am trying to automate the log in process to WebAdvisor. I have tried to select the "Log In" button by calling different elements. Each attempt so far has been unsuccessful.


Quote
(@abhijith)
Noble Member
Joined: 2 years ago
Posts: 1350
10/05/2021 11:16 am

Your xpath is wrong, Please find below solution.

fromseleniumimportwebdriverfromtimeimportsleepfromselenium.webdriver.supportimportexpected_conditionsasECfromselenium.webdriver.support.uiimportWebDriverWaitfromselenium.webdriver.common.byimportBy driver = webdriver.Chrome(executable_path=r"chromedriver.exe") driver.get("https://webadvisor.barry.edu/") element=WebDriverWait(driver,20).until(EC.visibility_of_element_located((By.XPATH,"//li[@id='acctLogin']//span[@class='label'][contains(text(),'Log In')]"))) element.click() element0=WebDriverWait(driver,20).until(EC.visibility_of_element_located((By.XPATH,"//input[@id='USER_NAME']"))) element0.send_keys("Test123")

ReplyQuote
Share:
Baidu