how to pass windows credentials in Url using Selenium in https - java

I tried using:
https://username:password#xyz.com
Using Alerts in Selenium.
Using Auto IT.
but nothing works for me.
AutoIT sometimes works and sometimes fails so it seems to be not reliable.
can anyone help with the same?

Related

Java Robot class not working from Jenkins

I am automating a scenario(selenium) where i need to enter credentials in Authentication Pop up, which is generated by the APP. I am using java Robot class to perform this function, it runs fine when i run it from my local machine which is a Windows Platform, but it doesn't seem to work when i trigger the build from jenkins. It hangs at a point where you need to enter the Credentials in Authentication Pop up. I think This is because the jenkins slave is an Unix Platform and this has something to do with the cross platform issue. As i am not sure if Unix Supports the Robot class.
Can somebody suggest me a workaround for this problem ?
Thanks in advance!!
The problem might be that you are testing on a headless server? Make sure your are not using firefox or chrome driver. Try to use the HtmlUnitWebDriver driver instead.

Handling alert popups using selenium in linux platform

I have an application to automate using selenium webdriver that has feature to browse and upload a file to the website. In windows, it was easy to use autoIt with selenium. It works fine. But if same code has to work on linux machine, the .au3 script might not work the way its expected to. Is there any alternative for this or I can still use same .au3 script to run on linux platform?
Is there any tool that can help me handle these popups on linux platform? I searched in this forum, but couldn't get any solution for my problem.

Chrome WebDriver doesn't select from dropdown

I have got the following code working on Firefox, but not on Chrome.
Select selectSize = new Select(dropDownListBox);
selectSize.selectByIndex(1);
I've tried using explicit wait and Thread.sleep(), but couldn't make it work.
When I debug the code, I found out that it actually grabs the value, but doesn't update the UI.
When I use System.out.println(selectSize.getFirstSelectedOption().getText()); it actually prints the size.
I've also tried running this code on iPhone and iPad emulators and it worked on there as well. I feel like this only doesn't work with Chrome Driver.
Has anyone had this issue before or do you have any suggestions?
Update: I'm using Selenium 2.41.0 and Chrome WebDriver 2.9.
Thanks in advance

Selenium rotate iOS device with Java

I have an issue that I cannot seem to resolve. I am writing an automated testing application in Java using JUnit/Selenium with Appium to test a website in the iOS simulator (Mobile Safari).
In this automated testing application I want to run some tests, rotate the device and run another set of tests. I've got everything working correctly except the rotation piece.
I found the following thread on how to rotate the iOS device in which someone suggested using the following Java code:
WebDriver augmentedDriver = new Augmenter().augment(driver);
((Rotatable)augmentedDriver).rotate(ScreenOrientation.LANDSCAPE);
However I am getting the following cast exception:
java.lang.ClassCastException: org.openqa.selenium.remote.RemoteWebDriver cannot be
cast to org.openqa.selenium.Rotatable
Has anyone else encountered this issue and know a fix/workaround? Maybe using Appium's JSON wire protocol?
Any help is greatly appreciated.
Thanks!
OK, so I finally figured out the issue. Annoying that after hours of searching and trying different things it was a very simple solution.
All that is needed is the following Capability:
cap.setCapability("rotatable", true);
Then use the following code to rotate the device:
WebDriver augmentedDriver = new Augmenter().augment(driver);
((Rotatable)augmentedDriver).rotate(ScreenOrientation.LANDSCAPE);
YEAH! Problem solved!
Rotation is not implemented and this request is marked as "won't fix". Check here.
As far as i know, this is because rotating screen is already implemented in Appium so yes, check the Appium API for solution. Alternatively you can try to execute javascript, something together with target.setDeviceOrientation, but I would go with the first one.

Selenium RC not able to work with downloads popup window

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

Categories

Resources