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

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.

Related

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.

Java Headless browser with Flash Support

I'm looking for a fast and reliable headless browser for Java that can interact with flash elements. I have already looked into PhantomJS, but there are too many errors when I try to run tests with PhantomJS on my target website. It also doesn't have flash support at all. If anyone knows of a headless browser that can interact with flash elements that would be great! Thanks!
Edit: So it appears that I need to state a problem and what I've done to try and solve it. The problem is that twitch.tv uses flash for many elements on their website, and when I try to run a headless browser such as HTMLUnit in Java or PhantomJS, they can't interact with those flash elements. I would like to know a workaround/solution for how I can continue using headless browsing but be able to interact with SWF elements.

open and monitor window running flash app without browser

My goal is to open a new window running a flash app from an url (http://curvefever.com/CF_Preloader.swf), and be able to interact with it with java, and do things like take screenshots of the content, and invoke keypresses.
while I could achieve this by opening the flash app in a browser and monitor the browser with selenium (and using an awt robot to take screenshots), I am looking for a better method because I want to avoid the extra lag brought with running the browser, but also because other windows might obstruct the screenshots when the browser window is in the background.
I think Selenium is still a good choice for manipulating the Flash application.
You can use the WebDriver's built in screenshot ability, which only captures the browser, so you won't have to worry about other windows obstructing the one you want to capture.
Take a screenshot with Selenium WebDriver

How to capture images from a flash application that runs in the background?

I am trying to capture images from a flash application that runs in a browser and process them in a java application.
So far, I am using (simplified):
Robot r;
BufferedImage i = r.createScreenCapture();
However, to make this work the browser always has to be in the foreground, since this is just a simple screen capture.
My question: Is it possible to capture image data from applications that don't run in the foreground or even access the flash application directly?
Note: It would also be okay, for me to do this with some script (e.g. in python) and then pass the data to the Java Application.
Thanks in Advance!
I think you can with Selenium:
Check the first answer in this post:
Take a screenshot with Selenium WebDriver
The used method's documentation: TakesScreenshot.getScreenshotAs()
It is not possible to take screenshots if the application is not in foreground. You can use Adrian's answer to take a screenshot if it is in foreground.

How do I handle a Windows Authentication using Selenium

I am attempting to automate a process using selenium with Java.
I am trying to navigate to a URL, which the test does do. A screen pops out over the top of Firefox asking for a user name and password. When this screen pops out, firebug stops working and I cannot get any information about this screen.
How do I handle a modal dialogue with Selenium, when I cannot find anything about it?
I guess, that you are trying to get to HTTP Authentification protected page. Try getting here like this:
driver.get("http://username:password#your-site.com");
Where driver is assumed as healthy and living instance of WebDriver
This actually did not work, the dialog still displays. Instead of running the tests in Firefox as I had wanted I ran them in IE which was using NTLM so I didn't need to input my information.

Categories