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

Exception in log when connecting to a browser #2

Open
GoogleCodeExporter opened this issue Aug 27, 2015 · 2 comments
Open

Exception in log when connecting to a browser #2

GoogleCodeExporter opened this issue Aug 27, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Run the example test
2. See selenium server logs


What is the expected output? What do you see instead?
No exceptions in the log. Actually I see exception on getting session 
capabilities request. See 
http://code.google.com/p/selenium/issues/detail?id=2091

What version of the product are you using? On what operating system?

webdriver-bindings-1.0.zip Yii extension on Linux with Selenium server 2.1.

It looks like a bug on selenium server side. Or may be it only happens for 
specific version of browser, but here's how we can avoid this erro if when 
creating the new session we don't allow curl to follow redirects:

public function connect($browserName="firefox", $version="", $caps=array()) {

...

    $this->preparePOST($session, $postargs);
    curl_setopt($session, CURLOPT_HEADER, true);
    curl_setopt( $this->_curl, CURLOPT_FOLLOWLOCATION, false);
    $response = curl_exec($session);
    $headers = explode("\r\n", $response);
    foreach ($headers as $h) {
        if (strpos($h, 'Location:') === 0) {
            $url = substr($h, strlen('Location:'));
            $this->requestURL = trim($url);
            break;
        }
    }
}


Original issue reported on code.google.com by [email protected] on 20 Jul 2011 at 12:24

@GoogleCodeExporter
Copy link
Author

I am experiencing the same issue.  Will there be a fix for this soon?

Original comment by [email protected] on 26 Jul 2011 at 2:19

@GoogleCodeExporter
Copy link
Author

This issue is detailed here:
http://code.google.com/p/selenium/issues/detail?id=2091

A fix:
In file WebDriver.php, look for:

   public function connect($browserName="firefox", $version="", $caps=array()) {
...
...
...
        $this->preparePOST($session, $postargs);
        curl_setopt($session, CURLOPT_HEADER, true);
ADD THIS LINE -> curl_setopt($session, CURLOPT_HTTPHEADER,  
array('application/json;charset=UTF-8', 'Accept: application/json'));
        $response = curl_exec($session);
        $header = curl_getinfo($session);
        $this->requestURL = $header['url'];
...


Original comment by [email protected] on 18 Apr 2012 at 1:13

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

No branches or pull requests

1 participant