How to open firefox "open menu" using keyboard shortcut? - java

How to open firefox "open menu" using keyboard shortcut?
I am unable to find the keyboard shortcut on google. I want to automate the process using selenium as I want to open an installed add on.

For an automation task like this you maybe using the wrong technology.
Have you tried using AutoIt for a task like this? Then switching back to Selenium when you need to interact with the DOM?

You can reach some of the main menu's options via the hidden extended menu set which can be shown after pressing Alt when not in fullscreen mode.

Related

WebRTC page automation checkbox is not enabling in headless chrome

In chrome we have Webrtc-Internals page I am trying to automate this website but I have a problem in doing it when you click on "Create Dump" dropdown we have two checkbox's
and
I am trying to click this element using "--headless" chrome without headless if you click it opens "save as" dialog box which cannot be automated using selenium cause it os-dialog box but when it comes to headless by click nothing popups and check box is not enabling no exceptions was shown, If you have an idea to automates this it would be helpful,
Sample code (Java) :
driver.get("chrome://webrtc-internals/");
driver.findElement(By.xpath("/html/body/p/details/summary")).click();
driver.findElement(By.xpath("//*[#id='content-root']/details/div/p[5]/label/input")).click();
driver.findElement(By.xpath("//*[#id='content-root']/details/div/p[1]/label/input")).click();
Thanks on advance!
Tried sendKeys also not working,
In a case it enables but can't save recording, Tried different type of chrome version

How can i press keyboard keys with selenium without physical keyboard

I'm trying to create automation with selenium that will install chrome extension.
I'm having a problem when i try to run this jar on amazon virtual machine,
because when i try to press enter with robot class it doesn't work because i don't have physical keyboard attached.
I can't use sendkeys within the selenium because the pop from google is not at the same page and selenium can't recognize it.
any solutions?
In that case you can use "sikuli" which is basically uses image recognition to identify and control GUI components. You can find it here
Steps would be :
Download sikuli java jar
Add this jar to your build path
Crop the pop up you want to click
Write desired sikuli code for that.
Please let me know if it can help You. If you wish to add sikuli in your project. I can help you for that very basic sikuli script.

Selenium - Clicking on a flash button which should open a new tab

I want to click on flash button which should open a new tab and in turn I need to do some operations on that page and return to the main page. Can anyone help with the code in Java? I have seen that flash doesn't work on Selenium, if so what are the alternatives?
I never tried, but i found this link, http://www.adobe.com/devnet/flash/articles/flash_selenium.html, maybe is useful for you. Is a plugin to use selenium in Flash front end

How to find main menus controls on safari in selenium webdriver using java

I am using Selenium Webdriver with Java. I have an issue: when I click on menu button, the menu control is notfound in safari browser. How do I solve it?
For this problem you have to use short cuts.
For example you need to open FILE menu then you have a short cut "ALT+F"
You can do this with Actions class in Selenium web driver.
Example:
new Actions(driver)
.keyDown(Keys.ALT)
.sendKeys("F")
.keyUp(Keys.ALT)
.perform();
Here I have use ALT + F key to open menu.
Your problem is solve easily by this code.
===============================================================
Note : If there is bug or defect in Safari Menu then This will not work properly. So please check it manually first then apply automation on that.Save time. :)

Window Dialogs & Popup handling in Java or Javascript

I need to manipulate Popups & Download Dialogs of IE browser using either Java or
Javascript based automated solution.
I tried with selenium2 but its not working properly so any other suggestion for the same.
Actually selenium2 does not provide proper handling of alert/download dialogs so
I am thinking to use some other javascript/java solution.
With Download Dialog: I need to save the downloaded file to particular location.
With Alerts Dialogs: I need to check the displayed message and click on the particular button.
Any suggestion is appreciated.
Thanks.
I use selenium 1 and it works well to handle popups in my application.
//Click on browse file button, open a popup
selenium.click("//input[#value='Browse...']");
//waiting for popup to load
selenium.waitForPopUp("_Dialog", "30000");
//selecting the popup by passing window name
selenium.selectWindow("name=_Dialog");
//click a link inside pop up window
selenium.click("link=something");
//Put other popup operations here
//click cancel button for pop up
selenium.click("cancel");
//back to main window
selenium.selectwindow("null")
To get the message from alert boxes, use selenium.getAlert();. This will return the message contained in the alert box as String.
Also, sometime you will need to check, whether alert has occurred before switching to it.
int noofWindows = selenium.getAllWindowNames().length;
if (noofWindows > 1){
//selects the second window
selenium.selectWindow(selenium.getAllWindowIds()[2]);
//Prints the message in the alert window
System.out.println(selenium.getAlert());
}
If it is not a necessity to run test in IE, use firefox(*chrome) and close all other windows before executing the code.
I hope this helps you.
*All the mentioned code is for handling JavaScript pop-ups. I'm not sure whether this will work for Vb-script or not.
EDIT
I think IE download pop up is a windows event so cannot be handled by selenium directly, for this you'll have to use Java AWT or AutoIT.
AutoIT script should be something similiar to
WinWaitActive(windowTitle)
ControlClick(windowTitle,"",buttonName)
and save it as IEsave.exe. NOTE: I'haven't tried this AutoIT script.
now you have execute IEsave.exe from your program. I'm using java here.
java.lang.Runtime.getRuntime().exec("c:/IEsave.exe");
This will execute the file which in-turn will handle the save button event for windows.
You can create similar exe files for handling other window's events.
Hope this solves your problem.

Categories