Clicking Table Element Using Python Selenium
I am working with python and selenium to click on the Upload button on a facebook page. The HTML associated with this seems to have a within a table tag. The html is as in the foll
Solution 1:
There is a multiple way to click on button you can try any of one
By using Xpath without wait: try: driver.find_element_by_xpath('your Xpath').click() print('Button clicked ok') except Exception as e: print('Error in clicking BTN : ' + str(e))
By using Xpath with wait:
try:
WebDriverWait(driver, 20).until(EC.element_to_be_clickable(
(By.XPATH, 'your Xpath'))).click()
print('Button clicked ok')
except Exception as e:
print('Error in clicking BTN : ' + str(e))
By using Css selector:
try:
driver.find_element_by_css_selector('a._3m1z').click()
print('Button clicked ok')
except Exception as e:
print('Error in clicking BTN : ' + str(e))
By using css selector with wait:
try:
WebDriverWait(driver, 20).until(EC.element_to_be_clickable(
(By.CSS_SELECTOR, 'a._3m1z'))).click()
print('Button clicked ok')
except Exception as e:
print('Error in clicking BTN : ' + str(e))
you can copy xpath by right click on element >>copy>>xpath
Post a Comment for "Clicking Table Element Using Python Selenium"