I have this element
<p><a onclick="return getpermission(this);" id="ctl00_ContentPlaceHolder1_btnSub" class="btn btn-danger" data-endisbutton="" href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$btnSub','')">▼ Taylor-Swift-Bad-Blood-ft.-Kendrick-Lamar.srt</a> <strong>Subtitle (.SRT) </strong></p>
on this page and I want to click on 'a' tag, so I found the 'a'tag element("elem") and ran (1st way) elem.click() then recieved
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <a onclick="return getpermission(this);" id="ctl00_ContentPlaceHolder1_btnSub" class="btn btn-danger" data-endisbutton="" href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$btnSub','')">...</a> is not clickable at point (185, 668). Other element would receive the click: <a href="https://www.rentanadviser.com/downloads/kripto_video_protector_setup.exe" rel="nofollow" target="_blank">...</a>
(Session info: chrome=99.0.4844.82)
then ran (2nd way)
from selenium.webdriver.common.action_chains import ActionChains
action=ActionChains(driver)
action.move_to_element(elem)#or the line below
action.move_to_element_with_offset(elem,0,80)
action.click()
action.perform()
then got error:
selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
(Session info: chrome=99.0.4844.82)
then did (3rd way) in which first element of elem1 is the elem(a tag)
driver.execute_script("arguments[0].click;", elem1)
which doesn't do anything.
btw this way I found 'elem'
links=driver.find_elements_by_tag_name("p")
for i in range(len(links)):
strong=links[i].find_elements_by_tag_name('strong')
if l(strong)>0:
if links[i].find_elements_by_tag_name('strong')[0].text=='Subtitle (.SRT)':
elem=links[i].find_elements_by_tag_name('a')[0]