pythonseleniumxpathwebdriverwaitdopostback

How to click on a link with Selenium with href="javascript:__doPostBack


I tried to click link from selenium.webdriver but I got it nothing. Can please help with this issue

Page contains the following elements:

<a href="javascript:__doPostBack("m_m_cBody_bdy_uc_tbl$Edit","13911")"> Details </a>

My target to click:

"m_m_cBody_bdy_uc_tbl$Edit","13911"

Please note that I have many text links with

Details

is not a unique element on my page

<a href="javascript:__doPostBack("m_m_cBody_bdy_uc_tbl$Edit","41946")"> 
Details </a>

Solution

  • To click on the element you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following locator strategies: