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 support missing for IE #32

Closed
adwu73 opened this issue Jan 16, 2012 · 9 comments
Closed

proxy support missing for IE #32

adwu73 opened this issue Jan 16, 2012 · 9 comments

Comments

@adwu73
Copy link
Contributor

adwu73 commented Jan 16, 2012

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

@adwu73
Copy link
Contributor Author

adwu73 commented Jan 17, 2012

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

@j1z0
Copy link
Contributor

j1z0 commented Jan 17, 2012

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

@adwu73
Copy link
Contributor Author

adwu73 commented Jan 18, 2012

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

@adwu73 adwu73 closed this as completed Jan 18, 2012
@adwu73 adwu73 reopened this Jan 18, 2012
@adwu73
Copy link
Contributor Author

adwu73 commented Feb 8, 2012

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.

@adwu73 adwu73 closed this as completed Feb 8, 2012
@adwu73 adwu73 reopened this Feb 8, 2012
@j1z0
Copy link
Contributor

j1z0 commented Feb 12, 2012

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

@adwu73
Copy link
Contributor Author

adwu73 commented Jul 6, 2012

this capability has been provided in 1.0.01

@rajsarodaya
Copy link

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.

@j1z0
Copy link
Contributor

j1z0 commented Sep 5, 2013

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.

@rajsarodaya
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants