can I run selenium 2 on real browser without webdriver? - java

Can I run Selenium 2 test cases (using Java) on a real browser (ex. Firefox) without using webdriver?
I would like to test the behavior on a real browser.
Thank you

Selenium 2 uses a "real" browser to execute your tests. The Webdriver is only to control the browsers (e.g. open a page, click on a button). However you also can test it in "remote mode" where no "real" browser is used.

Related

LeanFT and selenium webdriver screenshot - switching between

We are using selenium for web based applications and LeanFT for desktop & Citrix apps (eg: PowerBuilder, Terminal emulator) using Java
Using LeanFT or selenium exclusively causes no issues (we use LeanFT reporter and selenium TakesScreenshot) but the problem is, in one flow with screenshot capture, when we are switching context between LeanFT and Selenium.
What we have tried so far:
Tried switching to LeanFT screen capture if selenium getDriver returns null but this doesn’t, it fails if we start webDriver first
In our framework screenshot are taken part of onTestPass, onTestFail so end users doesn’t have to explicitly call getScreenshot.
Any idea what we could leverage to notify method to capture screen based on LeanFT or selenium?
The goal is to create a single report, by using both the results from selenium and the ones from LeanFT
Note: We don’t want to use LeanFT for everything (due to reusability of existing scripts) and we should use LeanFT for non web related systems

Using the same Firefox Window to run multiple tests in Selenium WebDriver (Java)

I am running test cases on selenium Webdriver in Java. The first test case opens the browser window and performs the test.
After the first test case is complete I want to utilize the same browser window to run the next set of multiple test cases.
How can this be achieved? Can someone point me in right direction?
Don't quit your browser in the "TearDown" part.
Navigate to a common URL in the "TearDown" part from where multiple test cases can start.
Thus you will be able to utilize the same browser window to run the next set of multiple test cases.
You can reuse a browser in multiple tests using Spring to inject it. This can be faster for running a suite. But, and it's a big but, if one tests "dirties" the browser (e.g. with cookies), then you could easily find yourself spending more time debugging flaky tests that you save on run time.
There's an example here: http://www.alexecollins.com/tutorial-integration-testing-selenium-part-1/

Run seleniumtest using webdriver java for all browsers, without opening any browser

I have a general question about selenium:
Is there a way to run selenium webdriverv2 using java, in different browsers(chrome\firefox\safari...) without opening any browser?
I read about selenium grid, unfortunate in grid it open the browsers/machines.
If you dont want to open a browser, then Selenium isnt for you. If you want headless testing my suggestion would be to look into CasperJS.
I don't use Selenium for 6 month, but when I used it, it was necessary to open the browser and I think still being like that today.

Using pre opened window with Selenium

I am trying to get Selenium WebDriver to find and use a browser window that is already open before the script executes. I am writting in Java.
I am using selenium-server 2.37.0 and the browser is IE8. I am open to using the Chrome browser as well.
Anyway, I have tried opening a driver instance and then looking for the window handles in the usual way (Set handles = driver.getWindowHandles();) but this only finds the hadle of the window that the driver opened. I have also just tried to switchTo the window by the window cannot be found.
The reason I want to use a pre-opened window is because when I execute my script, for some reason the browser won't let it click a link (It may be because the link is to an https address and sends a username and a token). When the script finishes the webpage won't respond to me manually clicking the link either.
I am able to manualy navigate to the link and click it the link works fine, so my thinking is that I can navigate to the page that I want and then kick of the scripts from there, but I need the webdriver to use this browser window that I used.
I cannot navigate the to link directly with Selenium because the link resided behind a secure server. I have to log in first then click the link and this is where I am having the problem.
Unfortunately, as of 2.37.1 (December 2013), it cannot be done.
There is an official feature request for this in the Selenium project (and it's even the most starred one), but it has not been done yet.
You can identify a browser window by windowHandle and switch between several Windows while testing.
You can print out all existing windowHandles (in your case it might be one) and then access it.
This solution worked for me (using Selenium 3.4.0):
Object[] handles = driver.getWindowHandles().toArray();
String windowHandle = handles[0]+"";
driver.switchTo().window(windowHandle);
After switching to your browser window you should be able to continue your test.
It relys on correctness of your webdriver- if you opened an Edge window the driver you use should be an EdgeDriver.

How to run a test case without opening the browser window?

I have created a set of test cases using Firefox Driver in Eclipse IDE.
But now I need these test cases to run without opening the browser window. How can I achieve that?
Presently I am using Firefox Driver Web Driver that runs in Firefox Browser.
Can some one help me with an example?
If you do not need to think about compatibility of different web browser, you could try Celerity. It could be run automated test script without any browser window.
http://celerity.rubyforge.org/
It is based on JRuby, and is very easy to learn and use.

Categories