相关疑难解决方法(0)

如何使用Java处理Selenium WebDriver的身份验证弹出窗口

我正在尝试使用以下代码处理身份验证弹出窗口:

FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("network.http.phishy-userpass-length", 255);
profile.setPreference("network.automatic-ntlm-auth.trusted-uris", "x.x.x.x");
driver = new FirefoxDriver(profile);
baseUrl="http://" + login + ":" + password + "@" + url;
driver.get(baseUrl + "/");
Run Code Online (Sandbox Code Playgroud)

当我执行测试时,页面显示身份验证弹出窗口,并且仍然加载直到我单击取消按钮.那一刻,我可以访问下一页,这意味着身份验证成功但仍然始终显示身份验证弹出窗口

java authentication selenium popup selenium-webdriver

50
推荐指数
4
解决办法
14万
查看次数

chrome.webRequest.onAuthRequired Listener

我试图拦截chrome扩展中的代理授权.在这里给出答案:Chrome扩展程序中的域授权和阅读文档,我的代码如下所示:

chrome.webRequest.onAuthRequired.addListener(
    function(details, callbackFn) {
        console.log("onAuthRequired!", details, callbackFn);
        //callback({
        //    authCredentials: {username: "1", password: "__TestUse"}
        //});
    },
    {urls: ["<all_urls>"]}
);
Run Code Online (Sandbox Code Playgroud)

问题是callbackFn 未定义但应该是一个函数.

任何人都有一些想法为什么callbackFn是未定义的.当我阅读文档时,我正在做对..

javascript webrequest google-chrome-extension

8
推荐指数
1
解决办法
5230
查看次数

使用用于Chrome浏览器的Selenium Web驱动程序执行自动化测试时,如何弹出NTLM身份验证?

我使用以下python代码绕过NTLM弹出窗口。

chromedriver = webdriver.Chrome(executable_path=chromedriver_path, chrome_options=options)
chromedriver.get("https://username:password@url.com")

Run Code Online (Sandbox Code Playgroud)

弹出窗口无法绕过,仍然存在,并且测试中断。

selenium python-3.x

6
推荐指数
1
解决办法
232
查看次数

chrome 扩展上的运行时错误

前提:

尝试编写一个非常简单的chrome 扩展,作为测试,我想添加控制台日志以进行调试。但是,我不断收到此错误

运行时未检查runtime.lastErrorwebRequestInternal.addEventListener您需要在清单文件中请求主机权限,以便收到来自 webRequest API 的请求的通知。

尝试:

我已经尝试添加我能找到的所有权限,但没有任何运气。有人可以帮我吗!

清单文件:

{
    "manifest_version": 2,
    "name": "test",
    "description": "testing app",
    "version": "1.0",
    "background": {
        "scripts": ["small.js"],
        "persistent": true
    },
    "permissions": ["webRequest", "webRequestBlocking", "tabs", "background", "storage"],
    "optional_permissions": ["http://*/*", "https://*/*", "<all_urls>"]
}
Run Code Online (Sandbox Code Playgroud)

小.js

chrome.webRequest.onBeforeRequest.addListener(function(details) {
    if (details.method === "POST") {
        alert('here');
        console.log('logging here');

    } else if (details.method === "GET") {
        alert('there');
        console.log('logging there');
    }
}, {
    urls: ["<all_urls>"]
}, ["blocking", "requestBody"]);
Run Code Online (Sandbox Code Playgroud)

javascript google-chrome google-chrome-extension

3
推荐指数
1
解决办法
3384
查看次数