Im Versuch, den XPath in einem iframe genannt zu bekommen "gadget_6" Wie nehme ich XPATH in einen Iframe?
i XPath von ausgewählten div benötigen. Selen Mit i tun:
self.change_frame('__gadget_6') #Change to the correct iframe
danach, ich versuche zu tun: für posterior tun
self.selec_orgvdc = self.driver.find_element(By.XPATH,'/html/body/div[5]/div/div/div/table/tbody/tr/td/div')
:
self.selec_orgvdc.click
aber ich erhalten den Fehler:
InvalidSelectorException: Message: invalid selector: Unable to locate an element with the xpath expression /html/body/div[5]/div/div/div/table/tbody/tr/td/div because of the following error:
SyntaxError: Failed to execute 'evaluate' on 'Document': The string '/html/body/div[5]/div/div/div/table/tbody/tr/td/div' is not a valid XPath expression.
Jemand kann mir helfen?
Neue Änderung:
self.change_frame('__gadget_6')
time.sleep(4)
self.logger.info("Buscando orgvdc")
#self.selec_orgvdc = self.driver.find_element(By.CSS_SELECTOR,'div.GN4Y2ATIMD table div.gwt-Label')
self.selec_orgvdc = self.driver.find_element(By.XPATH,'//div[5]/div/div/div/table/tbody/tr/td/div')
self.logger.info("Encontrado!")
Mögliche Duplikate von [Selen Unable zu Ortung Element (Python) WebScraping] (http://StackOverflow.com/Questions/32636453/selenium-unable-to-Locate-Element-Python-Webscrapping) – unutbu