Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy is not enabled for Internet Explorer when ie.usePerProcessProxy is true #5687

Closed
beluha opened this issue Mar 27, 2018 · 4 comments
Closed

Comments

@beluha
Copy link

beluha commented Mar 27, 2018

Meta -

OS: Windows 7, Windows 10

Selenium Version: 3.x (had a chance to reproduce in 3.7.1, 3.11)

Browser: Internet Explorer

Browser Version: 11.0.9600.18952CO, 11.966.15063.0CO

Expected Behavior -

For enabled ie.usePerProcessProxy the proxy is used for current IE browser process

Actual Behavior -

Proxy is ignored and is not used by current IE browser proxy at all when ie.usePerProcessProxy is true.

Steps to reproduce -

There is simple java code using BrowserMobProxyServer

import org.openqa.selenium.PageLoadStrategy;
import org.openqa.selenium.Proxy;
import org.openqa.selenium.UnexpectedAlertBehaviour;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.ie.InternetExplorerOptions;
import org.openqa.selenium.internal.ElementScrollBehavior;

import net.lightbody.bmp.BrowserMobProxy;
import net.lightbody.bmp.BrowserMobProxyServer;
import net.lightbody.bmp.client.ClientUtil;

public class IeProxy {
    private static BrowserMobProxy proxyServer = new BrowserMobProxyServer();

    public static void main(String[] args) throws InterruptedException {
        Proxy proxy = getProxy();
        InternetExplorerOptions internetExplorerOptions = new InternetExplorerOptions();
        internetExplorerOptions
            .setProxy(proxy)
            .requireWindowFocus().usePerProcessProxy().enableNativeEvents()
            .introduceFlakinessByIgnoringSecurityDomains().ignoreZoomSettings()
            .setUnhandledPromptBehaviour(UnexpectedAlertBehaviour.ACCEPT)
            .enablePersistentHovering().setPageLoadStrategy(PageLoadStrategy.EAGER)
            .elementScrollTo(ElementScrollBehavior.TOP).setCapability(InternetExplorerDriver.SILENT, true);

        WebDriver driver = new InternetExplorerDriver(internetExplorerOptions);
        driver.get("http://google.com");

        Thread.sleep(5000);

        // stopping driver and proxy
        driver.close();
        driver.quit();
        proxyServer.abort();
    }

    private static Proxy getProxy() {
        proxyServer.setTrustAllServers(true);
        proxyServer.start();

        return ClientUtil.createSeleniumProxy(proxyServer);
    }
}

If do not call usePerProcessProxy() then it means we use system proxy. And on the loaded page we will see expected behavior
expected

If to call usePerProcessProxy() then proxy is ignored at all. And unexpected and actual behavior for the loaded page is
actual

So for usePerProcessProxy() we expect to see
expected
for the driver.get("http://google.com");

Maven dependencies:

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.11.0</version>
        </dependency>        
        <dependency>
            <groupId>net.lightbody.bmp</groupId>
            <artifactId>browsermob-core</artifactId>
            <version>2.1.5</version>
        </dependency>

Related issues:
SeleniumHQ/selenium-google-code-issue-archive#8257

@beluha beluha changed the title Proxy is no enabled for Internet Explorer when ie.usePerProcessProxy is true Proxy is not enabled for Internet Explorer when ie.usePerProcessProxy is true Mar 27, 2018
@jimevans
Copy link
Member

Can you provide a trace-level log from IEDriverServer.exe?

@beluha
Copy link
Author

beluha commented Mar 27, 2018

Windows 7
ie.log
Attached.
Internet Explorer is in Program files.
My OS is 64-bit.
Screen from task manager for opened IE
after starting ie

Even at enabled "enhanced protected mode" selenium starts IE 32-bit.
With 32-bit IEDriverServer.exe this setting works fine and has expected behavior.

@beluha
Copy link
Author

beluha commented Mar 27, 2018

Windows 10
ie.log
OS 64 bit.
Even at enabled "enhanced protected mode" selenium starts IE 32-bit.

@jimevans
Copy link
Member

As I suspected, using the 32-bit driver works. You should almost certainly be using the 32-bit driver anyway, even on 64-bit Windows. The logs you collected even call this out:

W 2018-03-27 14:53:17:699 c:\projects\webdriver\cpp\iedriver\proxymanager.cpp(255) Proxy will not be set! There is a mismatch in the bitness between the driver and browser. In particular, be sure you are not attempting to use a 64-bit IEDriverServer.exe against IE 10 or 11, even on 64-bit Windows.

@lock lock bot locked and limited conversation to collaborators Aug 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants