selenium - 如果用户名包含 /,如何在 selenium 中传递基本凭据(代理凭据)
问题描述
我在设置代理的客户端环境中使用硒。每当我打开 chrome 驱动程序时,它都会要求提供凭据。我可以按以下格式传递凭据
String baseurl = " https://username:password@abc.com/Security/Login.asp
但我的用户名有 '/' 并且它不起作用
用户名 = 'account-01/d123456'
代码 :
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("excludeSwitches",
Collections.singletonList("enable-automation"));
options.addArguments("--disable-extensions");
options.addArguments("start-maximized");
options.addArguments("disable-infobars");
System.setProperty("webdriver.chrome.driver","./driver/chromedriver.exe");
WebDriver driver= new ChromeDriver(options);
//driver.manage().window().maximize();
String baseurl= "https://account-01/d123456:Rahul%456@abc.com/Security/Login.asp";
driver.get(baseurl);
解决方案
推荐阅读
- javascript - 在 JavaScript 中使用 Laravel 路由?
- python - 有没有办法通过shell脚本对一行的一部分进行排序
- python - 如何在用python重写行之前删除以前版本的行
- postsharp - 如何向方面/编译器生成的属性添加属性?
- asp.net-core - System.Reflection.TargetException(对象与目标类型不匹配)
- python - 解析日志文件并找到合适的分隔符
- image - 如何通过 Markdown 上的缩略图添加可点击、可展开的图片?
- python - 如何转换 pyspark 数据框列的值?
- pine-script - 我在哪里可以找到不同版本的 pine 脚本的文档,以及如何为 v3 实现标签
- c# - Viewengine 在控制器视图方法上使用静态类