-1

I am trying to add a confirmation link on selenium but selenium is not able to click on that link

its on yopmail with name janemartin90452

It doesn't click on the confirmation link Name "Activate Your Account"

emailconfirmationatyopmail = driver.find_element_by_css_selector('#mail > div > table > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(1) > td > table > tbody > tr:nth-child(5) > td > table > tbody > tr > td > a')

emailconfirmationatyopmail.click() 

Element is Activate Your Account

2
  • I have tried xpath as well Same thing Jul 26 at 15:31
  • <a name="CTA" bgcolor="#1dbf73" style="color: rgba(255, 255, 255, 1); background-color: rgba(29, 191, 115, 1); display: inline-block; font-family: Helvetica Neue; font-size: 16px; line-height: 30px; text-align: center; font-weight: bold; text-decoration: none; padding: 5px 20px; border-radius: 3px; text-transform: none" href="fiverr.com/… Your Account</a> Jul 26 at 15:39
0

That selector is positional based and likely to break as other emails pour in and/or the website updates its UI. Also, a .click() should "bubble" up from the to its parent <button> but we can target the button directly for interaction.

I checked out the inbox and was able to successfully find the parent <button> of the 'Activate Your Account' <div> using XPath.

//div[contains(text(), 'Activate Your New Account')]/parent::button

You can verify this by opening (F12) DevTools and doing a (Ctrl+F) search in the DOM tab.

4
  • Sir i am not quite Sure yet!! how will i impliment it? Jul 26 at 18:26
  • I am quite new in selenium Kindly If you could tell me what should I do Exactly on that link if possible Thanks Jul 26 at 18:27
  • driver.get("yopmail.com/") emailatyopamil = driver.find_element_by_css_selector('#login') emailatyopamil.send_keys("janemartin90452") P.press("enter") driver.findElement(By.xpath("div[contains(text(), 'Activate Your Account')]/parent::button")).click() # emailconfirmationatyopmail.click() Jul 26 at 18:32
  • driver.find_element_by_xpath(...).click()
    – kirbycope
    Jul 27 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.