caleeli / robotframework-seleniumlibrary

Automatically exported from code.google.com/p/robotframework-seleniumlibrary
Apache License 2.0
2 stars 0 forks source link

`Open browser` sometimes fails with Google Chrome with error `Cannot call method 'indexOf' of undefined` #187

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
library version:2.6
python version:2.6
operating system:windows xp

i've tried to "open browser" to visit www.google.com and www.yahoo.com,but it 
said

"Exception: Cannot call method 'indexOf' of undefined"

here are my test script:

from SeleniumLibrary import SeleniumLibrary
def test_login(params=None):
    _Extend_SeleniumLibrary = SeleniumLibrary(timeout=10)
    url_list = ['http://www.google.com','http://www.yahoo.com']
    for url in url_list:
        _Extend_SeleniumLibrary.open_browser(url, 'googlechrome') 
        _Extend_SeleniumLibrary.maximize_browser_window()

Original issue reported on code.google.com by huangyongde@gmail.com on 13 Apr 2011 at 2:09

Attachments:

GoogleCodeExporter commented 9 years ago
sorry,miss ']' at line 4
    url_list = ['http://www.google.com','http://www.yahoo.com']

Original comment by huangyongde@gmail.com on 13 Apr 2011 at 2:10

GoogleCodeExporter commented 9 years ago
First of all, if you are planning to use SeleniumLibrary with Robot Framework 
there's no need to write this kinf of extra wrapper library. You can just 
create a test that uses the keywords from SeleniumLibrary directly, for example:

***Settings***
Library  SeleniumLibrary  timeout=10

***TestCases***
Example
    Open Browser  http://www.google.com
    Open Browser  http://www.yahoo.com

The error you got nevertheless looks pretty weird. Could you run tests with 
debug level (i.e. use command line option `--loglevel DEBUG`) and copy the 
traceback that is logged with debug level here?

Original comment by pekka.klarck on 13 Apr 2011 at 8:57

GoogleCodeExporter commented 9 years ago
thanks pekka.klarck,here are my traceback records:

19:15:06.233 FAIL Cannot call method 'indexOf' of undefined
19:15:06.233 DEBUG Traceback (most recent call last):
 File "<string>", line 2, in open_browser
 File "D:\Autotest\Core\SeleniumLibrary\runonfailure.py", line 40, in _run_on_failure_wrapper
   return method(*args, **kwargs)
 File "D:\Autotest\Core\SeleniumLibrary\__init__.py", line 395, in open_browser
   self._selenium.open(url, ignoreResponseCode=True)
 File "D:\Autotest\Core\SeleniumLibrary\selenium.py", line 772, in open
   self.do_command("open", [url,ignoreResponseCode])
 File "D:\Autotest\Core\SeleniumLibrary\selenium.py", line 217, in do_command
   raise Exception, data

btw ,i think use wrapper lib is more flexible than tsv/txt textformat  :)

Original comment by huangyongde@gmail.com on 14 Apr 2011 at 11:22

GoogleCodeExporter commented 9 years ago
I tested that I got the same "Cannot call method 'indexOf' of undefined" with 
the following test data:

***Settings***
Library  SeleniumLibrary

***TestCases***
Example
    Open Browser  http://www.google.com  googlechrome

Using Chrome to test pages on localhost, where also my Selenium server was 
running, succeeded. I did a fast search with this error and found lot of 
results. It thus seems that this is a common problem in Selenium with Google 
Chrome. Unfortunately I don't have time to investigate this further in the near 
future. If you are willing to investigate this please keep this issue updated.

Original comment by pekka.klarck on 3 May 2011 at 1:50

GoogleCodeExporter commented 9 years ago

Original comment by pekka.klarck on 3 May 2011 at 1:50

GoogleCodeExporter commented 9 years ago
I have not been able to reproduce this and I anyway think that this is a 
Selenium problem. We will upgrade to Selenium server 2.3 in next release and 
hopefully this problem disappears.

Original comment by janne.t....@gmail.com on 8 Aug 2011 at 8:34

GoogleCodeExporter commented 9 years ago
Hi we are running version 2.4 and still having the same issue.

Original comment by shalu....@gmail.com on 24 Aug 2011 at 8:22

GoogleCodeExporter commented 9 years ago
You definitely should upgrade to the latest SeleniumLibrary version (2.8 at the 
moment). It contains the latest Selenium version and thus has also the latest 
Selenium fixes.

Original comment by pekka.klarck on 25 Aug 2011 at 12:25

GoogleCodeExporter commented 9 years ago
Hi I  am running selenium server version 2.4 now uppgraded to 2.5 but 2.8 
selenium library itself and still having issues.

Original comment by shalu....@gmail.com on 25 Aug 2011 at 4:45

GoogleCodeExporter commented 9 years ago
I did a search again and found an issue about this in Selenium's tracker:
http://jira.openqa.org/browse/SRC-740

It seems that this was once fixed in Selenium but later decided that the fix 
wasn't good and some --disable-web-security option should be used instead. 
Apparently this isn't an option for Selenium Server but so called "browser 
configuration option". Unfortunately I don't know how they can be passed using 
Selenium 1 RC API or is that possible at all.

I reopen this issue but don't have time to look at this any more deeply in the 
near future. If someone can find a way how to pass the --disable-web-security 
option or figures out some other solution, we surely will apply the fix in the 
next release. To start searching for more information you can do the same 
search I did:
http://www.google.com/search?q=selenium+googlechrome+Cannot+call+method+%27index
Of%27+of+undefined

Original comment by pekka.klarck on 25 Aug 2011 at 11:24

GoogleCodeExporter commented 9 years ago
Recent versions of Selenium RC support giving browser options, so I think this 
can be fixed by just hard coding --disable-web-security if the used browser is 
Chrome

Original comment by janne.t....@gmail.com on 15 Dec 2011 at 6:43

GoogleCodeExporter commented 9 years ago
This issue was updated by revision 0639cfa52553.

Original comment by janne.t....@gmail.com on 15 Dec 2011 at 6:55