이것은 Splinter 0.5.4 및 Python 2.7.5와 같습니다. Mountain Lion을 실행하는 MacBook Air의 Firefox 22.0.Splinter를 사용하여 테스트를 실행할 때 XPath가 연결을 해제하지 않습니다.
여기가 내가하려는 일입니다. -
1. Gmail에 로그인하십시오.
2. 휴지통 링크를 클릭하십시오.
3. 휴지통 페이지의 휴지통 비우기 링크를 클릭하십시오.
4. 확인 대화 상자에서 확인을 클릭하십시오.
Firebug/FirePath 사용 -이 XPath - `// div/div [3]/div [3]/div/span` 또는 `// div/div [3]/div [3]/div/span [@id]` 은 휴지통 비우기를 링크로 강조 표시합니다.
그러나 Splinter를 사용하여 실행하면 XPath는 해당 링크 ()를 해결하지 않으므로 링크 ()에서 click() 메서드를 호출 할 때 AttributeError가 발생합니다.
Splinter가 링크를 확인할 수없는 이유에 대한 아이디어가 있으십니까? 내가 확인한 바에 따르면 XPath 은 인 것으로 보입니다.
모든 도움을 주시면 대단히 감사하겠습니다.
def emptyTrash():
browser.click_link_by_href("https://mail.google.com/mail/u/0/?shva=1#trash")
print browser.is_element_present_by_xpath("//div/div[3]/div[3]/div/span", wait_time=5)
deleteLink = browser.find_by_xpath("//div/div[3]/div[3]/div/span[@id]")
print deleteLink #prints an empty list, since the above xpath is not finding the link
deleteLink.click() #AttributeError
trashokButton = browser.find_by_name("ok")
trashokButton.click()
절대 XPath가 '// div/div [2]/div [3]/div/span [@id]'로 업데이트되어 단축되었습니다. –