How can i press keyboard keys with selenium without physical keyboard - java

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.

Related

Show the Selenium browser window always on top

I am trying to create a project using Selenium and ChromeDriver.
I want to know if there is a way to ensure the Selenium browser window is always displayed on top of other windows, similar to what is possible with JFrames.
So far I didn't find any solution. The only things I found were to give the window focus, but I don't want to do that.
I thought of maybe there is a way to do it through the cmd, but I don't know much about that.

How can we run browser in background and Foreground with selenium?

I am using Sikuli and taking some input from user to automate a process. The browser should be in the foreground for sikuli to work properly.
So now, I want the browser to come to the foreground when Sikuli script is working. For that I searched for code on the internet and with this code following code and it is working:
driver.manager().maximize();
But to take user input from the console of eclipse, how to run browser in background. For that I am not able to find any code on internet.
Please suggest me some method with which selenium script can run browser on the background. Somebody on internet suggest docker-selenium but I don't want to use it and there is no minimize method like there is maximize.

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

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.

Verifying a dowload after clicking on download button using selenium for automation testing

Is there a way to check(for automation testing) whether a dowload has started or not, when clicked on a download button (clicked using selenium)?
Assume that save dialog box has been supressed in whichever browser I use
No, AFAIK with Selenium you cant check if download is in progress. But you can check the file once it is downloaded.
Link for more details.

Integrate Google Chrome browser into eclipse

I am trying to create an application using SWT Browser. Is it possible to integrate Google Chrome as browser into Eclipse (not as external web browser)?
No, as of current stable release of google chrome, you cannot use it inside SWT. The reason is that google chrome (and essentially chromium) doesn't support ActiveX (like IE, Firefox, Safari etc) but is based on NPAPI. (Note: I am considering that you are working on Windows machine as you haven't mentioned in your question !!)
But there are projects which are trying to make an embeddable version of chromium. See these links:
Chromiumembedded
Is Google Chrome embeddable?
You can set it through Eclipse UI.
Goto : Window > Preferences > General > Web Browser
Select "Use External Browser" radio button
Click "New" button to add a new browser eg. Chrome !
Click Apply + Ok
... and you have it working !
Bug 405031 - [Browser] implement Chromium support
https://bugs.eclipse.org/bugs/show_bug.cgi?id=405031
If you can not make it through UI, Try to edit settings in the following file.
YOUR-WORKSPACE\.metadata\.plugins\org.eclipse.core.runtime\.settings there will be a file called org.eclipse.ui.browser.prefs open it with any text editor and change the appropriate values, It is self descriptive you can easily find out what to change and all. Have a back up of the same before you modify.
Hope this helps you.
EDIT: Restart your eclipse to effect the above change.
To integrate Chromium into Eclipse or SWT applications you can use https://github.com/equoplatform/chromium-swt.

Categories