0

I'm working on simple automation in Selenium. I need to click a specific button. I can't because it is hidden in div/table without class.

I'm attaching a screenshot of the html. I did try xpath, css select, select and still nothing.

HTML

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
popo1992
  • 13
  • 1
  • 3
    Post your html in text format.Screenshot doesn't help other contributor to help you.Please post your code as well what you have done. – KunduK Sep 09 '19 at 21:38

2 Answers2

0

You could try clicking the div then. You can use XPath to locate the button element (as it has some class so you can locate it) and add /parent::div to get the div to click it.

RegCent
  • 98
  • 11
0

To click() on the button you have to induce WebDriverWait for the desired visibility_of_element_located() and you can use either of the following Locator Strategies:

  • Using CSS_SELECTOR:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "ul.nightclubs.unstyled > li > table.table.table-condensed button.btn.btn-inverse.btn-small.pull-right"))).click()
    
  • Using XPATH:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//ul[@class='nightclubs unstyled']/li/table[@class='table table-condensed']//button[@class='btn btn-inverse btn-small pull-right' and contains(., 'Wejd')]"))).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
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352