(Sorry - I frequent just Stack Overflow em Português but got no help this time, and my English isn't so good. But let me try:)
I want to extract a text that is variable conform the time of the soccer game basically, but I can't find this with XPath. And frankly, the HTML of the site doesn't help so much.
The HTML is this:
<div class="style_title__3UbkX"> "name_team_home" "0" <span>x</span> "2" "name_team_away" </div>
If the teams are Barcelona and Real Madrid, it appears like this in HTML code:
<div class="style_title__3UbkX"> "Real Madrid" "0" <span>x</span> "2" "Barcelona" </div>
And in the site it will appear in the center of the site something like
Real Madrid 0 x 2 Barcelona
(I can't send images yet)
But it can be different in different minutes of the game, but it doesn't matter, so if the Real Madrid team score a goal, the number in quote will change to 1.
This HTML for me is so strange because it's not separated. Is like this, it's a real copy from the site. I'm not used to use HTML, so I don't know if it's is normal tbh.
I want to extract the numbers in quote, 0 and 2 for a variable, but my code doesn't find this information. I'm trying to use XPath methods, like in this code, but both can't find the information:
goals_h = driver.find_element_by_xpath(
'//*[@id="root"]/div/section/section/main/div/div/div[2]/div/div/div[2]/text()[2]').text
or
goals_h = wait.until(EC.visibility_of_element_located((By.XPATH,
'//*[@id="root"]/div/section/section/main/div/div/div[2]/div/div/div[2]/text()[2]'))).text
I want the value in text()[2] in this XPath.
Someone know how to resolve this?
Thanks in advance.