admin管理员组文章数量:1353265
I am running a selenium on a site - / I am trying to get the response from above url, the driver code is as simple as
String url = "/"
driver.get(url);
After this, my selenium code is trying to get the Response headers by using below JavaScript - Contents of - responseHeaderJsScript
var req = new XMLHttpRequest();
req.open('HEAD', document.location, false);
req.send(null); var statusCode ='pStatusCode'.concat(': ').concat(req.status);
var statusText ='pStatusText'.concat(': ').concat(req.statusText);
var result = statusCode.concat('\n').concat(statusText).concat('\n').concat(req.getAllResponseHeaders());
return result;
Java code to execute above JavaScript -
JavascriptExecutor js = (JavascriptExecutor) driver;
String responseHeaders = (String) js.executeScript(responseHeaderJsScript);
List<String> headersList = Arrays.asList(responseHeaders.split(NEW_LINE));
The executeScript api call is raising below exception -
.openqa.selenium.JavascriptException: javascript error: {"status":19,"value":"Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'chrome-error://chromewebdata/'."} (Session info: chrome-headless-shell=124.0.6367.78) Build info: version: 'unknown', revision: 'unknown', time: 'unknown' System info: host: 'ip-172-31-59-7.us-west-2pute.internal', ip: '172.31.59.7', os.name: 'Linux', os.arch: 'amd64', os.version: '6.1.25-37.47.amzn2023.x86_64', java.version: '11.0.19' Driver info: .openqa.selenium.remote.RemoteWebDriver
This code works for 100s of public sites, but only with / site it fails.
本文标签:
版权声明:本文标题:javascript - Selenium throwing exception - org.openqa.selenium.JavascriptException - Failed to execute 'send' on 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743922845a2562411.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论