I've finished my automated script with python selenium in Chrome normal mode and everything works great.
Until I decided to make it work in headless mode, so now I cannot locate a partial link text which already works in normal mode.
I'm using this code to open chrome in headless.
option = webdriver.ChromeOptions()
option.headless = True
option.AddArgument("window-size=1200,700");
This the code that I use to locate the element
tmp = True
while tmp:
try:
Confirmm = driver.find_element_by_partial_link_text('Confirm')
Confirmm.click()
tmp = False
except:
continue
And this is the code of the link text I'm trying to click
<a href="https://temp-mail.org/en/view/346e2949a4a1f77ededd7542ba7947ed" title="" class="viewLink title-subject" data-mail-id="346e2949a4a1f77ededd7542ba7947ed">Confirm your profile</a>
NOTE: the data-mail-id= is not static and changes every time.
I tried to use Javascript but the word I'm willing to click doesn't have an ID, NAME, or TAG-NAME, and the ClassName doesn't work as well.
Any idea how to solve this?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…