Embedded mode with selenium doesn't load website
See original GitHub issueWhen using embedded mode in a selenium test, websites will timeout and not load. I have tried on google, npr.org, yahoo.com, etc. I’ve tried a couple things to see if it makes a difference but no luck so far: setting setUseECC to true, setTrustAllServers to true. I’ve tried on 2 different machines and same results. Is there something I’m missing?
Java v8 selenium v3.3.1 bmp v2.1.4
Here is my test case:
// Create bmp proxy
BrowserMobProxyServer proxy = new BrowserMobProxyServer();
// proxy.start(0);
try {
proxy.start(9091, InetAddress.getLocalHost());
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
proxy.setHarCaptureTypes(CaptureType.getAllContentCaptureTypes());
proxy.enableHarCaptureTypes(CaptureType.REQUEST_CONTENT, CaptureType.RESPONSE_CONTENT);
proxy.setUseEcc(true);
// Pass the proxy into desired capabilities
Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);
DesiredCapabilities caps = new DesiredCapabilities();
caps = DesiredCapabilities.chrome();
caps.setCapability(CapabilityType.PROXY, seleniumProxy);
// Turning off pop-up blocking
ChromeOptions options = new ChromeOptions();
options.addArguments("test-type");
options.addArguments("disable-popup-blocking");
caps.setCapability(ChromeOptions.CAPABILITY, options);
// Create the browser session
File file = new File(this.getClass().getResource(Constants.DRIVERS_PATH_LOCAL + "ChromeDriver.exe").getPath());
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
WebDriver driver = new ChromeDriver(caps);
// Create the har file
proxy.newHar("SalesforceAddCandidate");
// load website stuff
driver.get("http://www.npr.org/");
Har har = proxy.getHar();
File harFile = new File("C:\\temp\\SalesforceAddCandidate");
try {
har.writeTo(harFile);
} catch (IOException ex) {
System.out.println(ex.toString());
}
proxy.stop();
Issue Analytics
- State:
- Created 6 years ago
- Comments:29
Top Results From Across the Web
Some websites dont fully load/render in selenium headless ...
In this script, it doesn't load the login inputs when it accesses the discord API login page. As I can see in the...
Read more >Selenium Focus Element Issues And How To Solve Them?
This is a comprehensive guide to help you understand some common Selenium focus element issues and how to solve these issues, with examples....
Read more >Using https with Chrome in headless mode fails to load page
I have just starting testing with Chrome in headless mode. Works fine except in one case when I switch in the test run...
Read more >Selenium: Attach to an Existing Chrome Browser with C# ...
Using the power of Chrome to verify existing browser sessions during testing with Selenium so that you can verify items on the page....
Read more >How to modify HTTP request header in Selenium WebDriver ...
Now, I'm trying to use BrowserMob Proxy in Embedded mode, to achieve it, but something is not working. Proxy is running and ChromeDriver...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
try this. hope that works
replace this
with
great news!! you definitely are not cursed 😃