May-14-2022, 07:20 AM
(May-14-2022, 06:41 AM)ndc85430 Wrote: So,find_elements_by_xpath
returns a list (the name suggests that, as "elements" is plural). You should probably just drop the.text
there I guess? You're later iterating on the list and asking for.text
on each item.
Output:runfile('C:/Users/.spyder-py3/untitled1.py', wdir='C:/Users/.spyder-py3')
https://results?department=RP&recordedDateRange=18000101%2C20220506&searchOcrText=false&searchType=quickSearch
C:\Users\.spyder-py3\untitled1.py:11: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
driver=webdriver.Chrome(r'C:\Users\Desktop\webdrivers\chromedriver_win32\chromedriver.exe')
C:\Users\.spyder-py3\untitled1.py:23: DeprecationWarning: find_elements_by_xpath is deprecated. Please use find_elements(by=By.XPATH, value=xpath) instead
results = driver.find_elements_by_xpath("/html/body/div[2]/main/div[2]/div/div/article/div[3]/div/div[2]/div[1]/table/tbody/tr[1]/td[3]")
Number of results 1
0
0 <selenium.webdriver.remote.webelement.WebEleme...