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.
Related
When we use JAWs for accessibility purpose we find an issue with Tab button. It's work correct for IE browser, but wrong for Edge. When SWT Edge browser widget display and we use Tab button JAWs pronounce wrong Link/Button label, (it repeat the previous one, but if we click Enter right link will open).The issue is random, sometimes it's work correct but sometimes simply repeat the previous Link title/label. It's work ok if I use U button but wrong for Tab. I've tested browser's part locally running it at Edge browser and found that Tab button work correct with JAWs. But when I run application as a part of Eclipse RCP application with SWT Edge browser I found an error. It seems like we have some conflict/problem between SWT Edge and Jaws. May be some one understand the problem and can help with it? Thank you
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've an issue with my IE browser when running selenium WebDriver java scripts. For a while it will run in front of the screen, at some point of time it's going behind the screen and what ever other windows opened in the system comes to front. This is affecting the flow of the scripts run mostly. Can any one suggest a solution. Thanks !!!
There was a known issue with the IE window being pushed to the bottom of the Z-order (to the background) when doing certain operations with the IE driver. Among these were calling WebElement.click() and selecting elements in a <select> element. These issues were corrected in 2.26.0.9 of the IEDriverServer.exe. Updating both your language bindings and your IEDriverServer.exe to the latest version (2.28, at the time of this writing) will likely solve your issue.
I've solved this issue to some extend by using window.focus() method. Where ever IE window goes behind the screen, we must use it to bring it back infront of the screen. Here's the code snippet ((JavascriptExecutor)driver).executeScript("window.focus()");
Thanks :)
I'm wondering if there would be any solution to show and focus on browser's tab containing a javafx 2 applet programmatically from the applet.
I don't think there's a simple solution, but who knows :)
PS : Obviously, stage.requestFocus() and stage.toFront() don't work.
No, there's absolutely no way to do this using no custom native bridge doing the job, even with a javascript bridge.
With the next versions of JavaFX neither.
And applets are not supported anymore in Chrome, so I think nobody would try that anymore.
I'm working on an application that uses the SWT Browser widget to display an HTML page with some JavaScript in it. The JavaScript tries to use window.resizeTo to change the size of the window, but it currently isn't having any effect.
I've fiddled with the browser settings, and it doesn't seem to be an issue with the underlying browser; switching between Mozilla and Internet Explorer rendering engines has no effect. I suspect that SWT simply doesn't automatically re-size the window in response to JavaScript functions.
I can easily re-size the window from my Java code, but I need to know when to re-size it, and how big JavaScript wants it to be. Does SWT provide a way to listen for this? If so, how?
I still don't know of any way to get this information, but a work-around is to change SWT versions. Some of them implement JavaScript's window.resizeTo automatically, and some of them do not.