Skip to content

proxy support missing for IE #32

Closed

Description

@adwu73

it seems that currently selenium2lib doesn't support testing via IE proxy. I have some tests works fine without proxy in IE, however, when I configured proxy, then I got following errors:

WebDriverException: Message: '\n\n<title>404 Not Found</title>\n\n

Not Found

\n

The requested URL /hub/session was not found on this server.

\n\n

I am wondering whether any one has solutions for this already?

Thanks!

Adam

Activity

  1. adwu73 commented on Jan 17, 2012

    @adwu73
    ContributorAuthor

    it seems that the issue lies in following code in _browsermanagement.py

    def _make_browser(self, browser_name):
        browser_token = self._get_browser_token(browser_name)
        browser = None
        if browser_token == '*firefox':
            browser = webdriver.Firefox(webdriver.FirefoxProfile(FIREFOX_PROFILE_DIR))
        elif browser_token == '*googlechrome':
            browser = webdriver.Chrome()
        elif browser_token == '*iexplore':
            browser = webdriver.Ie()
    

    There is no handling of proxy. According this wiki: http://seleniumhq.org/docs/04_webdriver_advanced.html
    we should set proxy like this:

    PROXY = "localhost:8080"

    webdriver.DesiredCapabilities.INTERNETEXPLORER['proxy'] = {
    "httpProxy":PROXY,
    "ftpProxy":PROXY,
    "sslProxy":PROXY,
    "noProxy":None,
    "proxyType":"MANUAL",
    "class":"org.openqa.selenium.Proxy",
    "autodetect":False
    }

    you have to use remote, otherwise you'll have to code it yourself in python to

    dynamically changing the system proxy preferences

    driver = webdriver.Remote("http://localhost:4444/wd/hub", webdriver.DesiredCapabilities.INTERNETEXPLORER)

    I will try to provide a fix soon

  2. j1z0 commented on Jan 17, 2012

    @j1z0
    Contributor

    Hey Adam,

    Currently there is no support in Selenium2Lib for passing in profiles when creating a browser. That is something that I have been planning to add but just haven't had the time yet. If you want to hack it you can change the _make_browser function in the browsermanagement.py class. Otherwise I hope to have a fix checked in by end of next week.

    Cheers,
    Jeremy

    On Jan 16, 2012, at 10:06 PM, adwu73 wrote:

    it seems that currently selenium2lib doesn't support testing via IE proxy. I have some tests works fine without proxy in IE, however, when I configured proxy, then I got following errors:

    WebDriverException: Message: '\n\n<title>404 Not Found</title>\n\n

    Not Found

    \n

    The requested URL /hub/session was not found on this server.

    \n\n

    I am wondering whether any one has solutions for this already?

    Thanks!

    Adam


    Reply to this email directly or view it on GitHub:
    #32

  3. adwu73 commented on Jan 18, 2012

    @adwu73
    ContributorAuthor

    Hi Jeremy,

    Thanks for your feedback. Since I am not quite familiar witht the difference of IE driver and Remote driver, I would like to wait for your fix instead.

    Regards!

    Adam

  4. reopened this on Jan 18, 2012
  5. adwu73 commented on Feb 8, 2012

    @adwu73
    ContributorAuthor

    I need to use this feature so, so I will go ahead to add this feature in. Since Selenium 1 set the proxy during Start Server process, and Open Browser won't take proxy use parameters, I will add a new keyword Set Proxy to init the proxy setting, and Open Browser will use the proxy info accordingly.

  6. reopened this on Feb 8, 2012
  7. j1z0 commented on Feb 12, 2012

    @j1z0
    Contributor

    Hey Adam,

    I have just committed some changes to S2L that allows the open_browser keyword to open remote connections. You have to do the following.

    1. Start the selenium_standalone_server.jar
    2. Open browser ie remote_url=http://127.0.0.1/wd/hub desired_capabilities=httpProxy:yourproxy,ftpProxy:yourproxy

    that should do it. I don't have a proxy server setup so I didn't test the proxy setup but I did test pretty extensively the ability to use the selenium removing and the desired_capabilities so let me know if it works for you.

    Cheers,
    Jeremy

  8. adwu73 commented on Jul 6, 2012

    @adwu73
    ContributorAuthor

    this capability has been provided in 1.0.01

  9. rajsarodaya commented on Sep 5, 2013

    @rajsarodaya

    I had this use case where in I was supposed to pass an entire URL in desired capability.

    Since there were two semicolons in the name:value pair (app:https://apk-recovery.googlecode.com/files/apiDemos.apk), it didn't worked as expected.

    I have done some alteration in the _browsermanagement.py file so that the separator is altered to " ! " instead of " : ".

    Please tell me what need to be done so that new _browsermanagement.pyo & _browsermanagement.pyc files can be created.

  10. j1z0 commented on Sep 5, 2013

    @j1z0
    Contributor

    To answer your question if you just want to make a change for your self just make the change and rerun pybot the change and the pyc file will automatically be regenerated.

    As a more general solution I think we could probably make a small change to the _parse_capabilities_string function so it would ignore the second : . I'll try to find some time to get that implemented ASAP.

    Cheers,
    Jeremy

    On Sep 5, 2013, at 14:36, rajsarodaya notifications@github.com wrote:

    I had this use case where in I was supposed to pass an entire URL in desired capability.

    Since there were two semicolons in the name:value pair (app:https://apk-recovery.googlecode.com/files/apiDemos.apk), it didn't worked as expected.

    I have done some alteration in the _browsermanagement.py file so that the separator is altered to " ! " instead of " : ".

    Please tell me what need to be done so that new _browsermanagement.pyo & _browsermanagement.pyc files can be created.

    —
    Reply to this email directly or view it on GitHub.

  11. rajsarodaya commented on Sep 5, 2013

    @rajsarodaya

    Thanks for the fix Jeremy.
    For now it is working as per need.

    --Raj.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions