Home > Back-end >  NoSuchElementException. Trying to click on a div tag
NoSuchElementException. Trying to click on a div tag

Time:08-18

Im trying to click on a div tag. I've been trying different combinations of locators for the past several hours and can't for the life of me figure out how to fix it. It is not in an iframe.

Here is the line of python code:

WebDriverWait(browser,20).until(EC.element_to_be_clickable((By.CSS_SELECTOR,"#mail > div > div.view-columns.backface_fix.flex-grow.rel > div:nth-child(1) > div > div > div > div.rel.flex-grow > div > ul > li:nth-child(1) > div > div.flex-grow.min-width-0 > div.bottom.flex-space-between > div"))).click()

this is the html:

<div >Proton Verification Code</div>

CodePudding user response:

WebDriverWait(browser,20).until(EC.presence_of_element_located((By.XPATH,"//div[@class='text-ellipsis flex-grow']"))).click()

CodePudding user response:

You did not provided enough information in your post so we can't give you a 100% correct solution, however maybe this will work for you:

WebDriverWait(browser,20).until(EC.element_to_be_clickable((By.XPATH,"//div[contains(text(),'Proton Verification Code')]"))).click()

  • Related