我有一个基本的设置方法:
class BaseTestCase(object):
def setUp(self):
options = webdriver.ChromeOptions()
options.add_argument("download.default_directory=C:\Users\cverma\Desktop\SOAPProject")
self.driver = webdriver.Chrome(executable_path=r"C:\chromedriver\chromedriver.exe", chrome_options=options)
self.driver.maximize_window()
self.driver.get("https://qa.smartsimpleqa.com")
def tearDown(self):
self.driver.quit()
当我在另一个测试中调用此设置方法时。我的文件一直在默认下载文件夹中下载,而我想在单击C:\Users\cverma\Desktop\SOAPProject
之后下载我的文件
尝试以下操作:
也要注意,如果您将错误的路径设置为“download.default_目录值,您将不会得到异常-chromedriver将只使用下载文件夹作为默认值
相关问题 更多 >
编程相关推荐