Home > Blockchain >  By.XPATH problem in an automatic click with Selenium
By.XPATH problem in an automatic click with Selenium

Time:04-14

I would like to automatically click on the blue logo of the likes (the one with the thumb inside), in order to open the list of those who have left the likes. I am referring to this little blue logo:

enter image description here

In the question I want to focus only on this small request, on this small click. I think I am doing it right, but surely there is something wrong. I used By.XPATH., More precisely: //*[@id="jsc_c_z"]/span[1]/span/span/div

WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="jsc_c_z"]/span[1]/span/span/div'))).click()

This instead is the link I would like to open enter image description here

I hope someone can help me. Thanks

CodePudding user response:

Hey you can try the Xpath like this,

//*[@id="jsc_c_z"]/span[3]/div/img

as the image tag has the link and not the div tag If it does not work, try adding the arial label while locating the div.

CodePudding user response:

the ids and spans in this page look suspiciously obfuscated, and thus won't necessarily be the same every time. I don't think the id="jsc_c_z" will be reliable. you may need to resort to using the aria-label attribute on the target div element.

  • Related