2

I am trying to get the Panel Report of WTO automatically using selenium package in python.

https://docs.wto.org/dol2fe/Pages/FE_Search/FE_S_S006.aspx?Query=(@Symbol=%20wt/ds2/*)&Language=ENGLISH&Context=FomerScriptedSearch&languageUIChanged=true#

while I was working with above page, I've got into error - that no element is not gettable.

In other words, specially I'd like to inspect "Panel Report Tab" and click it, like using the following code:

driver.find_element_by_xpath('//*[@id="ctl00_ContentLeft_Tabs_tab001_wpcTypesTreeView_trvTypes"]/ul/li[8]/div/span[2]')

but keep failing with an error message :

NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="ctl00_TopLevelNavigationWUC_lnkRecentDocuments"]"} (Session info: chrome=63.0.3239.132) (Driver info: chromedriver=2.34.522932 (4140ab217e1ca1bec0c4b4d1b148f3361eb3a03e),platform=Mac OS X 10.13.2 x86_64)

So I had tried this with another xpath, but keep returning same error.

How could I get the element for clicking to get into the panel-report page?

EDIT: I am using Python but one user referred this question to JAVA cases and marked it as a duplication.

snapper
  • 997
  • 1
  • 12
  • 15

1 Answers1

0

You can use below code:-

 element = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.XPATH, "//*[@id='ctl00_ContentLeft_Tabs_tab001_wpcTypesTreeView_trvTypes']/ul/li[8]/div/span[2]"))
    )
Ankur Singh
  • 1,239
  • 1
  • 8
  • 18