我们有一台Ubuntu服务器,我们用它来运行Chrome和Firefox(我安装ChromeDriver)的Selenium测试,我也想在我的Windows 10计算机上本地运行测试。我希望两台计算机的Python代码保持一致。但我没有找到如何在Windows 10上安装ChromeDriver?我没有在文档 [1,2]上找到它。如何在Windows 10上安装ChromeDriver并使用Chrome运行Selenium测试?
这里是运行Chrome的测试代码:
import unittest
from selenium import webdriver
class BaseSeleniumTestCase(unittest.TestCase):
...
...
...
...
def start_selenium_webdriver(self, chrome_options=None):
...
self.driver = webdriver.Chrome(chrome_options=chrome_options)
...
我还发现How to run Selenium WebDriver test cases in Chrome?但它似乎没有在Python
(无需编程语言标记,它是什么?) 更新#1:我在https://sites.google.com/a/chromium.org/chromedriver/getting-started中发现了一些Python代码,但是如果我想为两台计算机保留相同的Python代码,我会在哪里将文件放在Windows 10中?
更新#2:我下载并把chromedriver.exe
在C:\Windows
和它的工作,但我没有看到它在任何地方记录。
这是最新的Chrome更新后仍然适合你吗?我的测试浏览器现在在一个小的命令提示符窗口旁边出现空白。 –
@AlexR是的,它的工作原理。 – Uri