Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用Selenium web驱动程序,我无法在driver.get()方法中传递某些http身份验证凭据_Python_Selenium_Selenium Webdriver - Fatal编程技术网

Python 使用Selenium web驱动程序,我无法在driver.get()方法中传递某些http身份验证凭据

Python 使用Selenium web驱动程序,我无法在driver.get()方法中传递某些http身份验证凭据,python,selenium,selenium-webdriver,Python,Selenium,Selenium Webdriver,我想使用URL通过Chrome中Selenium WebDriver的HTTP基本身份验证检查。 要打开站点,我使用如下代码: from selenium import webdriver from src.pom import settings PATH = settings.chromedriver_path driver = webdriver.Chrome(PATH) driver.maximize_window() driver.get('https://username:Z

我想使用URL通过Chrome中Selenium WebDriver的HTTP基本身份验证检查。 要打开站点,我使用如下代码:

from selenium import webdriver

from src.pom import settings

PATH = settings.chromedriver_path

driver = webdriver.Chrome(PATH)

driver.maximize_window()

driver.get('https://username:Ziel#0Fehler@www.google.com')
然而这给了我
selenium.common.exceptions.InvalidArgumentException:消息:无效参数

如果删除用户名和HTTP Auth密码之间的#或:,则不会抛出错误,但我需要HTTP Auth的确切数据

import urllib.parse

password = 'Ziel#0Fehler'
password = urllib.parse.quote(password)

driver.get(f'https://username:{password}@www.google.com')

您有url编码密码,因为它具有在url中具有特殊含义的特殊字符,例如:#

url应该类似于:driver.get(“https://:@www.google.com”)