Unable To Fit The Two Expressions Into My Script
I've written a script to scrape documents from a web page using python in combination with selenium. However, the only thing I got stuck is print the value. As selenium doesn't sup
Solution 1:
Try below code and let me know in case of any issues:
Name = driver.execute_script('return arguments[0].childNodes[1].textContent', docs) # To get Name text valueAddress = driver.execute_script('return arguments[0].childNodes[3].textContent', docs) # To get Address text value
Solution 2:
your commented expressions are retrieving webelements. I'm assuming that there is just one name, so the code should use find_element_by_xpath (without the "s"). If you want the text that appears in those elements, ask for that attribute:
Name = docs.find_element_by_xpath('//div[@id="schoolDetail"]/text()[1]').text
Address = docs.find_element_by_xpath('//div[@id="schoolDetail"]/text()[2]').text
Post a Comment for "Unable To Fit The Two Expressions Into My Script"