Robot Framework browser support - selenium

Has the robot framework support for IExplorer or only for Firefox and Chrome?
(If yes, how to configure it?)
Thanks!

Robot Framework does not, in itself, support any particular browser, so I am guessing you are referring to either SeleniumLibrary or Selenium2Library which use selenium and selenium 2 respectively. The browser support of these is well documented at seleniumhq and there is much support out there. It is recommended for new projects to use Selenium2Library as this will receive ongoing support.

Please check the driver compatiblity for browser.

You might have already known of IE driver.
Apart from that you also need to check Python version- Selenium2 version - IE Driver version - IE browser version compatibility.

In addition to #theheadofabroom 's answer, I should add that Internet Explorer does not play well with Robot Framework. Your test might not work for any number of reasons on IE while it may work just fine on FireFox and Chrome, but the most common is timing. IE is just slow enough that when Robot Framework goes to click on the next element, it searches the page for it, but it hasn't loaded in yet. As long as you have the Selenium webdriver for IE installed correctly and have written your Robot Framework code correctly, I'd recommend adding some Sleep keywords between actions to slow your code down and increase the probability that the element you want to click will load before Robot Framework searches the page for it. This is especially true if you're writing for Chrome and want to send it to either Firefox or IE.

Open Browser ${WEBAPPURL} ${BROWSER} is the keyword to open the browser.
For Firefox you can use firefox/ff instead of ${BROWSER}
For Google Chrome you can use googlechrome/gc/chrome instead of ${BROWSER}
For Internet Explorer you can use internetexplorer/ie instead of
${BROWSER}
For Firefox you don't need any driver but IE and Chrome you need to install the drivers
You can find the installers in and info here for Chrome and here for IE

Download IEdriver exe from here and put this exe file in Scripts folder of your Python installation directory. For eg, in my case it is C:\Python27\Scripts.
Ride will now launch IE for you.

Robot class supports keyboard inputs regardless of the browser. It is a class from the java.awt package and not specific to any browser. It is used in automation for performing operations on the web browser(stand alone application) in which a web-page is being automated
Note that it cannot perform operations directly on the web browser as it's a stand alone application, but can make use of keyboard shortcuts to indirectly perform the operation.
For example, if you want to open a new tab in a browser, you can use the Robot class to press Ctrl+t instead of trying to click on the new tab.
Code to use it to open a new tab in your program
Webdriver driver = new ChromeDriver(); //FirefoxDriver(), IntrrnetExplorerDriver();
driver.get("......");
//code goes here
//to open a new tab
Robot rob = new Robot();
rob.keyPress(Keys.VK_CTRL);
rob.keyPress(Keys.VK_t);
rob.keyRelease(Keys.VK_CTRL);
rob.keyRelease(Keys.VK_t);
//itetator to switch between the tabs

Related

How do I make Internet Explorer driver invisible using Selenium and VB?

I am using Selenium WebDriver to make some automations, using chrome I can use the headless argument to hide it, but I don't know the argument to hide the Internet Explorer.
Dim driver As New ChromeDriver
driver.AddArgument ("headless")
Dim driver As New IEDriver
driver.AddArgument ("?????????????????????")
Library used - A Selenium based browser automation framework for VB.Net, VBA and VBScript
Based on my searching results, it looks like Internet Explorer does not support Headless mode.
As a work around, you can use trifleJS.
It can emulate some IE versions in a headless mode.
References:
(1) How to Set capability for IE browser to run in Headless mode
(2) TrifleJS

How to disable firefox from opening while running test suite in Selenium IDE?

I am writing test scripts in Selenium IDE for my application but everytime when I run the test suite it opens up browser and performs all the actions and logs failures, if any. My requirement is to invoke the test script from command prompt using .bat file and generate a test report. I am able to do the same but the problem is firefox opens up and executes the test case one by one. Can anyone please suggest me how to disable Firefox window from opening up? Or is it just not possible to do so? Or do I need to switch to Selenium Webdriver in order to achieve my requirement? My application contains Ajax upto a lot of extent.
I have read many commands used in Selenium IDE but I could not find any command which can serve this purpose. Please suggest!
If you know any programming language supported by selenium-webdriver (Ruby, Java, Python, C#) then you should try PhantomJS WebDriver which allow to run scripts without opening visual browser session
Selenium-IDE are mean to invoke browser, that's how the script react to all the exact browser behavior.
Only selenium Webdriver allow you to run your browser under "Headless" mode, which in fact, put Firefox under X-virtual frame buffer in background, as above #Andersson suggested.
Unfortunately, there is no easy way to convert your Selenium-IDE script to your desire programming language at the moment.
If your concern is about "cluttered screen" in OS such as ubuntu, then your solution will be export the whole Selenium-IDE and firefox under another virtual X-display.

Open phantomJS using robot framework with javascript off

Is there a way to open PhantomJS browser with JavaScript off?
I have used the following code but JavaScript is still enabled.
Open Browser url phantomjs desired_capabilities=javascriptEnabled:False
Thanks
Zied
No. The Robot framework uses Selenium to run web tests. The Selenium Webdriver support in PhantomJS is provided by Ghostdriver which is fully implemented in JavaScript and partially runs inside of the page context. If JavaScript would be disabled, then you couldn't use the webdriver protocol anymore to talk to PhantomJS.

Why do we need IEDriver and ChromeDriver but no Firefox Driver?

I have small doubt.
Why do we need IEdriver and Chrome Driver running selenium scrits in IE and Chrome but we do not need a firefox driver to run the script?
Is there any reason for the same?
This is because of the Native Browser approach used in WebDriver.
Each and every browser uses different JS Engine.
All drivers [Chrome Driver, IE driver, etc.,] are built based on the special JS Engine used by each browser.
Selenium offers inbuilt driver for Firefox but not for other browsers. [Not sure it may happen in future, since TestNG and JUnit library files are a part of Selenium-standalone-server right now]
Straight from a google search for FirefoxDriver, the official documentation states:
Firefox driver is included in the selenium-server-stanalone.jar available in the downloads. The driver comes in the form of an xpi (firefox extension) which is added to the firefox profile when you start a new instance of FirefoxDriver.
External drivers are the preferred process by the Selenium developers. They allow the driver versioning to be tied more closely to the browser than to Selenium, and they can be supported by the browser authors (e.g., ChromeDriver, OperaDriver). There is a long-standing plan to replace FirefoxDriver with a Mozilla-supported driver based on Mozilla's "Marionette" architecture.
Firefox driver is already included in the selenium-server-standalone.jar package.

Run Geb tests with chromeDriver without opening the browser

I want to run my Geb specs with chrome driver without having to watch the tests on the browser? can this be done?
P.D.: I know I can use the HtmlUnitDriver, but this driver sometimes gives my errors (caused mainly by timeouts) that the chrome driver don't.
There is currently no way to do this with Chrome, Safari, Opera or FireFox, however there are multiple options you can do. First is to pipe the "window" into a virtual frame buffer (if you're using Linux). This process will pop open the browser, only in memory. I talk about this in my blog post (http://www.ensor.cc/2011/05/maven-javascript-unit-test-using.html) during the maven pre-integration phase
The other option is to use the brand new GhostDriver. GhostDriver is a WebDriver implementation of PhantomJS which is a headless WebKit. This is WAY better than HtmlUnit but still has some features being built out. GhostDriver is currently not in Maven Central, so you will need to manually add it to the common repository. You can then use it as a WebDriver. This has worked for me with moderate success (90% of my test cases dropped in without any changes needed).
Read this first: http://blog.ivandemarino.me/2012/12/04/Finally-GhostDriver-1-0-0
Then refer to the GitHub README and code: https://github.com/detro/ghostdriver