I want to use selenium RC without TestCase, Junit or SeleneseTestCase.
I want to write a code which performs automation of my website. I don't want to use any Testing fromework link testCase or SeleneseTestCase.
I want just write a code and run my code without any testing Cases.
Is this possible?
You can try the Selenium Webdriver API http://seleniumhq.org/docs/03_webdriver.html.
It does not force you to use JUnit or the like. It simply starts a browser and executes your commands. You can still access page contents and examine them if you like.
Yes you can! :D
When I'm bored, I usually use Selenium to tweet on Twitter or post in Facebook. I'm still amaze in what Selenium can do. but in a way, we don't fully use the functionality of Selenium in doing so.
FYI you can do that in both Selenium RC and WebDriver :D
Related
I'm developing an application for automation of an upload process on a website. Right now it is working with Gecko Driver on Firefox but I want to change to HtmlUnitDriver. For this application I just started using Selenium. At the begin I just used methods on WebElements (e.g. click() ...). Then there was a difficult part where it doesn't worked out. After that I found the JavascpriptExecutor class. This class was the solution of my Problem. Now I am thinking about totally change from WebDriver Methods to JavaScriptExecutor. I think it will be faster and less error-prone. Am I right? Are there any disadvantages for me to change to JavascriptExecutor?
Thanks in advance.
For QA testing generally one should not use JavascriptExecutor.
Read more about Why using JavascriptExecutor in WebDriver can be dangerous.
But for getting stuff done and fast It is great!
Read more about What are the advantages of using a JavaScript executor in Selenium.
Hope this helps you!
I have a ui test that uses selenium chrome driver. I want to set the form filling speed to be slower. I have googled but couldn't see how.
Does someone know how to do this?
In Selenium 1 you can use setSpeed method, in Selenium 2 (aka WebDriver) is, unfortunately, no option like this, at best you can use Implicit waits. However is not really recommended to slow down the Selenium for all tests, you should add waits only for tests which really need to wait for some action to complete.
I am having old test automation framework developed using Selenium 1.0 and now wants to migrate my code to WebDriver.
Is there any easiest method to do this migration?
I have overridden most of the methods such as type, click, getText, getSelectedLabel, assert etc etc. I see the only method is to re-write all methods again from scratch, I have already started this process but If I continue with the same method It will take many days for me.
Please suggest if anyone has any better approach.
Thanks in advance.
They are completely different technologies. There is no way to migrate them over to selenium 2 per se.
Luckily, the recent Selenium releases have implemented what's called "WebDriver Backed Selenium" so technically if you are using those tests, it's implicitly running them "as" WebDriver tests.
Other than that, no, there is no easy way.
I had the same issue - we are migrating our entire regression suite over to S2 now :)
In the Webdriver documentation, they explain a method to start migrating from Selenium RC to Selenium WebDriver.
Basically, is creating the selenium object like this:
WebDriver driver = new FirefoxDriver();
Selenium selenium = new WebDriverBackedSelenium(driver, "http://www.yoursite.com");
the main problem with this migration (instead of changing the whole code) is the wait for page to load. As they say, the command WaitForPageToLoad returns too soon. The getEval is another command that you have to change.
I think that the best approach is to make functions with the main commands that differs from Selenium RC to Selenium WebDriver, and, once everything is "working" keep modifying your code until no Selenium RC is present. This is how we did the migration, and we had lots of lines of code.
This is the link, where they explain how to start:
http://www.seleniumhq.org/docs/appendix_migrating_from_rc_to_webdriver.jsp#migrating-to-webdriver-reference
I am new to the selenium RC. I have been working in eclipse to run a simple junit test case to run and download flashplayer from adobe.com.
But the selenium RC is not able to click or even recognise the downloads pop up window. I have been seeing several suggestions in google search but still I am not able to do it.
I have been trying to get the window ID or name of the pop up window to work with it, but still I am not able to do it. I have copied the major function of my code here down below:
public void testPopup() throws Exception
{
selenium.open("http://get.adobe.com/");
selenium.open("/flashplayer/");
selenium.click("id=buttonDownload");
String ids[]=selenium.getAllWindowIds();
for(int i=0;i<ids.length;i++)
System.out.println(ids[i]);
String[] windownames=selenium.getAllWindowNames();
for(int i=0;i<windownames.length;i++)
System.out.println(windownames[i]);
String feedWinId = selenium.getEval("{var windowId; for(var x in selenium.browserbot.openedWindows ) {windowId=x;} }");
System.out.println(feedWinId);
selenium.chooseOkOnNextConfirmation();
selenium.waitForPageToLoad("30000");
}
It will be great if someone can help me out with this.
Thanks
The short answer: you can't.
The longer, but still disappointing answer:
You can't, because no current Selenium implementation supports it. The Selenium people know about it, it's actually nr. 13 in most wanted features in Selenium right now
Selenium RC will never have it because of its technical limitations (It's pure JavaScript. And pure JavaScript can't download and save files.) and it has been deprecated over a year ago. Selenium WebDriver ... well, maybe, in the future. The various things you can try instead:
Rethink whether you really need to download the file. Isn't is ok just to assert that the file exists and can be downloaded by making a HTTP request and seeing that the answer was 200 OK?
Can't you download the file using pure Java after you get it's URL via Selenium? I personally think this is the best way to go.
If you're using WebDriver, there is a great tool for downloading files!
If you're using Firefox, you can set up a clean testing profile that will be configured so that it will download every clicked file into some specified folder. There are addons out there that can help you with it, too. I'm not sure whether Selenium RC supports usign a precreated profile, but Selenium WebDriver definitely does.
If you're using one given browser to do your tests, you can figure out how to download a file "blindly" by pressing buttons blindly. The Robot class can help you with that. You just click the file and then blindly press Enter or whatever keys to download your file into the right place. There is also AutoIt framework which a lot people use for this task.
You can not automate system generate pop-up by using selenium.
For that you have shift over Autoit with selenium.
With the help of this you can records your activities on download pop-up
I can run a single selenium test in play's browser UI, however, is it possible to execute a play selenium test on the command line?
Obviously if I run play auto-test it will execute all my selenium tests (as well as my junit tests). Is there a way that I could tell Play to execute just a single selenium test on the command line to check whether it works using the headless browser?
I don't think it's possible to do so with the current play framework,
but see how auto-test works on
https://github.com/playframework/play/blob/master/modules/testrunner/src/play/modules/testrunner/FirePhoque.java .
It get the play test lists on /#tests.list , maybe you could try to override it providing what you want to test.
Anyway, I don't see the usecase of testing only one test in a headless browser.