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
Related
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.
We use driver.manage().window().maximize(); to maximize the browser.
I have seen few examples online that are using driver.manage().window().maximize() though it's not required to maximize the browser. (For Ex: gmail login)
Also I see on invoking browser using selenium it opens in maximized window only. Still I have to use this driver.manage().window().maximize();
Short answer: Yes.
Little longer answer: when selenium is interacting with the web page, like clicking on button or writing to text field, the interacted WebElement must be visible, or you will get exception. If you think on performance calling one time to window().maximize() is much 'cheaper' (and much less prone to errors) than scrolling to the WebElement every time.
You gave Gmail login as example, but usually you need to do more than just login in tests project.
By the way
Also I see on invoking browser using selenium it opens in maximized window only
Is not true.
It depends on your choice. If window is not maximized, probably You might not be able to find element on page. So if you need such element then it worth to maximize window.
As [pratapvaibhav19] said, it's totally depends on your choice.
There are different ways of doing this, you can open maximized Chrome windows. For Firefox and IE you can use driver.manage().window().maximize();. Alternatively you can open browser window as per your screen resolution OR in custom size.
You don't have to maximize the window.
Selenium can interact with the browser in any screen resolution, because it doesn't use the mouse or keyboard like desktop automation tools.
It's just easier to view web pages and take screenshots on bigger browser windows.
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.
I am writing a web app with java. I am curious to know if there is a way that I can switch between the browser window (running the web app) and a local Java client application window (standard Java window). The Java Window is Oracle Forms.
For example, when i'm running the web app in my internet browser and I click a button. I want the button to execute process to switch from the internet browser window to the local java/forms window. Thus I would need something to execute on the OS level to switch my window.
How could I do this? I'm interested in any idea that would make that usecase work. For example, I probably need to introduce and integrate new technologies with my app? Probably a Java Applet?
Thank you,
Gavin
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.