How to remove text from a site and put in a variable, when it does not find with xpath the path

Asked

Viewed 19 times

0

Good morning!

I am trying to extract from a site a text that is variable, but it does not find the element with the find_element_by_xpath or with the Wait.until(EC.visibility_of_element_located((By.XPATH,'xpath'

The code of the site in this part is:

inserir a descrição da imagem aqui

I specifically wanted to put 0 in one variable and 1 in another, but he doesn’t find these elements that way.

The code I have so far on that particular part is:

gols_h = driver.find_element_by_xpath('//*[@id="root"]/div/section/section/main/div/div/div[2]/div/div/div[2]/text()[2]').text
gols_a = wait.until(EC.visibility_of_element_located((By.XPATH, '//*[@id="root"]/div/section/section/main/div/div/div[4]/div/div/div[1]/div[4]/span/text()[3]'))).text

This score of the game has in two parts of the site, however are similar... so I’m trying this two ways with 2 different xpaths, but both does not return a value in the variable goals_h/gols_a

I also know that xpath this way is not ideal, but this site is a problem because the places have equal names, and it is poorly separated classes, so I used xpath same.

What would be the way to extract these hints?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.