有什麼方法可以在同一個程序中同時使用selenium功能和webdriver功能嗎?我試圖截圖和硒在該命令崩潰「.capture_entire_page_screenshot(...)Selenium Webdriver Python並排
1
A
回答
1
我不會嘗試混合SeleniumRC(版本1 API)與WebDriver(版本2 API)。這將是兩次痛苦,沒有樂趣。
使用webdriver的,你有沒有試過
import contextlib
import selenium.webdriver as webdriver
with contextlib.closing(webdriver.Firefox()) as driver:
driver.implicitly_wait(10)
driver.get('http://www.google.com')
# driver.get_screenshot_as_file('/tmp/google.png')
driver.save_screenshot('/tmp/google.png')
0
你可以相信你所看到的錯誤詳細點嗎?也許有一些你的代碼錯誤。這工作完全適合我在Selenium 1中:
from selenium import selenium
import unittest, time, re
class IIIAppforloop(unittest.TestCase):
def setUp(self):
self.verificationErrors = []
self.selenium = selenium("localhost", 4444, "*firefox", "http://www.yahoo.com/")
self.selenium.start()
def test_i_i_i_appforloop(self):
sel = self.selenium
sel.open("/")
sel.wait_for_page_to_load(60000)
sel.capture_entire_page_screenshot(r"C:\picture.png", " ")
def tearDown(self):
self.selenium.stop()
self.assertEqual([], self.verificationErrors)
if __name__ == "__main__":
unittest.main()
相關問題
- 1. Python Selenium Chrome Webdriver
- 2. StaleElementReferenceException selenium webdriver python
- 3. Python + Selenium Webdriver
- 4. python中的selenium webdriver
- 5. selenium python webdriver xpath error
- 6. Python Selenium WebDriver拖放
- 7. Python 3.5 Selenium Webdriver IE
- 8. Selenium WebDriver python綁定
- 9. Selenium Webdriver Timeout(Python 2.7)
- 10. Python Selenium webdriver查詢
- 11. Selenium Webdriver測試 - Python
- 12. Python Selenium webdriver:調試
- 13. Java與Python的Selenium Webdriver
- 14. Python Selenium Webdriver:查找404s
- 15. Python Selenium webdriver緩慢打字
- 16. Python的Selenium Webdriver - driver.title參數
- 17. Python Selenium webdriver loop with addition
- 18. 用Python和Selenium Scraping JavaScript Webdriver
- 19. 來自Selenium的Python webdriver
- 20. Selenium WebDriver - 處理StaleElementReferenceException(Python)
- 21. 使用iframe的Python Selenium webdriver
- 22. 滾動到Selenium Webdriver(Python)
- 23. Selenium Webdriver NoSuchElementException
- 24. Selenium Webdriver
- 25. Selenium遠程WebDriver
- 26. 用selenium webdriver chrome
- 27. Selenium webdriver掛在element.click
- 28. Selenium WebDriver Session
- 29. JavaScript和Selenium WebDriver
- 30. Selenium WebDriver Testng