我想通過提及各自的版本運行我的測試在我的機器上安裝的Firefox的差異版本,我讀這個鏈接https://stackoverflow.com/questions/12596097/how-to-set-particular-firefox-version-in-selenium-webdriver
,但我不想手動創建配置文件,並通過相同的,是他們在運行時的任何方式決定選擇哪個版本?如何讓Firefox在Selenium webdriver上運行特定版本?
3
A
回答
4
設置WebDriver時,請嘗試使用FirefoxBinary
類。
例如:我假設你有FF 15安裝在C:\testing\ff15\firefox.exe
之後,建立的webdriver之前:
File pathToBinary = new File("C:\\testing\\ff15\\firefox.exe");
FirefoxBinary binary = new FirefoxBinary(pathToBinary);
FirefoxDriver driver = new FirefoxDriver(binary, new FirefoxProfile());
我從來沒有嘗試過,但我認爲它應該工作
0
而對於使用python使用FirefoxBinary
那些指定路徑火使用FirefoxBinary狐狸二進制:
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
browser = webdriver.Firefox(firefox_binary=FirefoxBinary('path goes here'))
希望它可以幫助別人:)
相關問題
- 1. 如何使用Maven在Firefox中運行Selenium WebDriver測試用例?
- 2. 如何使用Selenium webdriver與Ruby更改Firefox的默認版本?
- 3. webdriver-manager如何安裝selenium版本npm
- 4. 如何運行Meteor的特定版本?
- 5. 如何讓Maven在Firefox 3.6中運行Selenium測試?
- 6. 從Python CGI腳本運行Selenium webdriver
- 7. 如何讓selenium-webdriver忽略Firefox和PhantomJS中的SSL錯誤?
- 8. 如何在Tomcat服務器上運行Selenium webdriver?
- 9. eclips上selenium webdriver運行時錯誤
- 10. 使用Python中的Selenium webdriver在後端運行Firefox
- 11. 如何在Selenium WebDriver(Selenium 2)中運行Firebug?
- 12. Cordova運行錯誤的Java版本。我如何讓科爾多瓦運行特定的Java版本?
- 13. WebDriver - 在運行webdriver/selenium測試時運行插件
- 14. 如何在運行Selenium Webdriver(Python)測試時使用javascript加載Firefox禁用?
- 15. 如何配置firefox以在特定鏈接上運行emacsclientw?
- 16. 如何使用Selenium Webdriver單擊具有特定文本的div?
- 17. 如何讓Jmeter版本3.12腳本運行到舊版本2.11?
- 18. Selenium WebDriver + Firefox 7.0.1不兼容
- 19. 如何在Linux上使用Selenium-rc上的Firefox進行Firefox
- 20. 如何讓Selenium WebDriver使用Socks代理?
- 21. 使用xvfb-run(Selenium WebDriver)運行firefox問題
- 22. Selenium Webdriver Firefox 52 Python每次運行選擇隨機代理
- 23. 在ssh中運行Python Selenium webdriver
- 24. 在AWS EC2中運行selenium webdriver linux
- 25. Selenium webdriver ruby版本聲明並驗證
- 26. 如何使用Selenium Webdriver作爲其他用戶運行Firefox瀏覽器?
- 27. 如何用一個Firefox實例,Selenium WebDriver和Python一起運行多個測試?
- 28. 如何定位特定版本的C++運行時?
- 29. 如何讓PHPUnit + Selenium運行得更快?
- 30. 如何使用Firefox 19中的Selenium WebDriver進行鼠標懸停?
上午剛剛從最終用戶的前瞻性思考,用戶將提供輸入的唯一版本,是他們沒有辦法讓火狐的路徑根據版本安裝? – user1787641 2013-03-25 14:37:20
好吧,是和否 - 是的,只有在你的磁盤上有巧妙的文件夾結構的情況下。例如,每個版本都將在** ffXX **子目錄中,其中XX是所需的版本。 – 2013-03-25 14:51:42