Home > Enterprise >  Selenium did not print text inside the span tag
Selenium did not print text inside the span tag

Time:06-30

url = .

CodePudding user response:

Class name 'a-offscreen' is not unique, so it fetches more than one element. The first one is hidden, so .text won't give you text value

Either try

driver.find_elements(By.CLASS_NAME, 'a-offscreen')[N]  # set index of required element instead of N

or use unique locator

P.S. Do NOT post your code as image!!!

  • Related