I'm trying to print 2 text files under an element separately, but because I can't select text files directly with selenium (like 1st text, 2nd text)
I want to select 'Home Win' separately 'PSV vs Ajax'
my code:
driver.get("https://footystats.org/predictions/home-wins")
matches = driver.find_elements_by_xpath("//div[@class='predictionsList']//div[@class='betWrapper ']//div[@class='betHeaderTitle']/text()")
predictions = driver.find_elements_by_xpath("//div[@class='predictionsList']//div[@class='betWrapper ']//span[@class='market']")
odds = driver.find_elements_by_xpath("//div[@class='predictionsList']//div[@class='betWrapper ']//div[@class='betHeaderMeta']")
for x in range(0,len(matches)):
print(matches[x].text, predictions[x].text, odds[x].text, sep="\t")
If I make my code like this, it gives an error;
The result of the xpath expression is: [object Text]. It should be an element.
if I delete '/text()' from the 'matches' element, it takes 2 texts at once.
