[Selenium2Library] Running the simplest testcase fail with "[ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: No browser is open"

6,993 views
Skip to first unread message

Yan Zhang

unread,
Aug 12, 2013, 1:59:31 AM8/12/13
to robotframe...@googlegroups.com
The simplest testcase:
*** Settings ***
Library           Selenium2Library

*** Test Cases ***
test1
    Open Browser    http://www.google.com    firefox
    Sleep    2 min
    Close Browser
------------------------------------
os: windows7
python 2.7.3
robotframework-2.8.1.win32
robotframework-selenium2library-1.2.0
selenium-2.33.0
decorator-3.4.0
docutils-0.11



Thanks.

Elsa

log.html

Kevin O.

unread,
Aug 12, 2013, 1:31:55 PM8/12/13
to robotframe...@googlegroups.com
The traffic between the WebDriver client and driver server (the Firefox plugin) is being routed through your proxy and it is rejecting it.
If you have the environmental variable HTTP_PROXY set, WebDriver will use it, causing your problem.
To resolve, try also setting the environmental variable
NO_PROXY=127.0.0.1

Yan Zhang

unread,
Aug 12, 2013, 9:54:09 PM8/12/13
to robotframe...@googlegroups.com
Hi Kevin,

Thanks a lot!

My question solved according to your answer.

Cheers,
Elsa

Salman Ali

unread,
Feb 5, 2014, 10:56:47 AM2/5/14
to robotframe...@googlegroups.com

Hi Guys !

I seen the discussion of two .
I am new to the Robotframework environment and new to this group as a matter of fact.

I wrote more or less the same code ,FYI I am using  RIDE as my editor.

Even though I have added environmental variable HTTP_PROXY, HTTPS_PROXY and No_PROXY set, but still having the issue .

Code:

*** Settings ***
Library           Selenium2Library

*** Variables ***
@{txt_username}    user1    user2
@{txt_password}    12345    6789

*** Test Cases ***
TC1
    Given url is opened
    When user enter credentials
    When click on login button
    Then home page should appear

*** Keywords ***
Given url is opened
    open browser    http://gmail.com    ie

When user enter credentials
    Input Text    id=user    @{txt_username}[0]
    Input password    id=pass    @{txt_password}[1]

When click on login button
    click button    id=login

Then home page should appear
    element should be visible    id=view_profile

Error:
20140205 09:40:07.385 :  FAIL : No browser is open

Note: 
I attach the log . Kindly help. Thanking in advance. 
log.html

Kevin O.

unread,
Feb 5, 2014, 1:38:05 PM2/5/14
to robotframe...@googlegroups.com
Your error is due to the server for IE missing (look at the failure message for the test not for the screenshot). IEDriverServer is not installed automatically - you can download it here.
IEDriverServer.exe needs to be on the path - you can test by typing iedriverserver on a command prompt.
If you want to use a server that is not on the path - it is possible using Create Webdriver.

Kevin

Salman Ali

unread,
Feb 5, 2014, 6:55:15 PM2/5/14
to robotframe...@googlegroups.com
Hi Kevin !

Thanks for the reply . What you mean by the path ? Are you trying to say IEDriverServer.exe or the zip file should be the folder where the Internet Explorer already installed ? 

Secondly unfortunately iedriverserver does work on windows cmd. 

I have tried with the Firefox too . In case of Firefox, the browser does open but it didn't take the URL as defined in the test case. And it fails coz of the same reason. 

Regards,
Salman Ali

Ed Manlove

unread,
Feb 5, 2014, 9:03:51 PM2/5/14
to robotframe...@googlegroups.com
The windows command path - which what you get when you type

   echo %PATH%

at the command prompt. The windows command path needs to pint to the directory containg the IEDriverServer.exe file.

Most likely your python install is on that path and possible listed as C:\Python27 as well as a few other paths related to that python install, like C:\Python27\Scripts. I have placed the IEDriverServer.exe in the C:\Python27\Scripts directory as it is on the path and a folder for python executables (which this is not per se but Robot Framework and Selenium - that being the python bindings - are python ). Or sometimes I have put the IEDriverServer.exe file in its own directory like C:\Utilities\Selenium\Drivers and simply add this to the windows command path.

Note also that is needs to be  on the windows command path and not the python path which is a whole different path.

Ed
--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/groups/opt_out.

Ed Manlove

unread,
Feb 5, 2014, 9:06:02 PM2/5/14
to robotframe...@googlegroups.com
That should have said

The windows command path needs to point to the directory containing the
IEDriverServer.exe file.

A guy with Mustache

unread,
Feb 6, 2014, 1:01:56 PM2/6/14
to robotframe...@googlegroups.com
It worked . Thanks Guys . Appreciate it. 

Regards,
Sal

E T H I E S

unread,
May 4, 2015, 8:58:10 AM5/4/15
to robotframe...@googlegroups.com
Hi,

Another solution

Selenium2Library version update helped me to resolve this issue.

pip install --upgrade robotframework-selenium2library

refer: https://github.com/rtomac/robotframework-selenium2library

MD SHARIB Imam

unread,
Sep 21, 2017, 7:34:02 AM9/21/17
to robotframework-users
Hi
Yan Zhang can you provide me code for the same ..still i am stuking in that part

i am getting error like this :User must sign in to check out :: This is some basic info about th... | FAIL |
OSError: [Errno 20] Not a directory


Tatu Aalto

unread,
Sep 22, 2017, 1:03:13 AM9/22/17
to imamsh...@gmail.com, robotframework-users
Ugh

The issue is many years old and many things have changed since. Could you tell which keyword actually fails and show with simple example how you use that keyword. Also could you run the test with "--loglevel trace" set from command and send the stack trace back (please note that it may contain confidential information and because this is a public forum, you may want to remove the confidential information).

If the error happens in SeleniumLibrary or Selenium2Library keyword, could you please update your Selenium and the browser driver to the latest version and give it a new try.

-Tatu
Send from my mobile

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframework-users@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages