1

I tried:

WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,"//*[@value='Sign Out']"))) 

but no luck.. please see image for the html script

image

DebanjanB
  • 118,661
  • 30
  • 168
  • 217
Nick
  • 13
  • 2

1 Answers1

0

The desired element is a JavaScript enabled element so to click on the element you have to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following Locator Strategies:

  • Using CSS_SELECTOR and click():

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "form[action*='Logoff']>li>input[value='Sign Out']"))).click()
    
  • Using XPATH and submit():

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//form[contains(@action, 'Logoff')]/li/input[@value='Sign Out']"))).submit()
    
  • 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
    
DebanjanB
  • 118,661
  • 30
  • 168
  • 217