Selenium Automatically Closes Chrome Console (attached or window) - java

When debugging in Chrome I expierence that Selenium is automatically closing the console window/tab (F12) even if it resides in its own detached window.
This really distrubt or even make driving a debugging session with selenium impossible.
Is there a known workaround or is this a feature I have to live with?

Related

Closing chrome browser after tests with Appium? JAVA

I'm trying to find a way for me to close all tabs of chrome after performing certain tasks with Appium using Java, for example on Android. Is there a way I can do that? All tabs keep growing and growing and that causes the tests to crash.
One possible solution is to clear the application data using ADB:
adb shell pm clear com.android.chrome
You may do this as a precondition for your tests, for example somewhere in #BeforeClass or #BeforeSuite if you use TestNG. The side effect is that you have to accept terms and conditions upon chrome opening and click the No thanks button on the Sign-in to Chrome View. But this is not a big deal.
Pros: clean Chrome browser without any tabs and cache on every test run
Cons: some Chrome initialization is required every time (~5..10 seconds to perform)
You can also try another approach as written here: https://developers.perfectomobile.com/display/TT/How+To%3A+Close+Tabs+in+Google+Chrome
Create a function (inside your app #BeforeSuite or #BeforeClass) that will simulate touch events of a mobile user that press a button to close all chrome tabs.

Popup window just below the address bar , how to handle this using selenium webdrier

I am using selenium webdriver to automate my application , using firefox and chrome as two browser. My application require Gemsafe software support, due to this a popup is appearing on when I am launching the application just below the the address bar, text is “Allow and don’t allow”. I am not able to handle this popup. Can anyone know help me out on this ?
I'm not sure but I think this is the small yellow toolbar right below the address bar that is warning you that Gemsafe, etc. needs to be enabled on the site and prompts the customer to Allow or not.
If so, this is not part of the HTML of the page and cannot be interacted with using Selenium. The simple way to determine this is to right-click on the "popup" and see if you can Inspect Element, etc. If not, it's part of the browser and can't be accessed using Selenium.
I would recommend that you set each browser up in such a way (before the tests) that the Gemsafe software support is already set up. I think a customer would only have to click Allow once for a site, just do that on each supported browser (sounds like only Chrome and FF). There may be some browsers where additional setup is required to permanently allow this. You will have to do research for those browsers.

How to open chrome driver (Using Selenium Webdriver) in foreground. By default its opening in background with no focus

I've been using chrome driver (with selenium wedriver), so far it never caused any issue, now for some requirement it has to be in foreground with focus on it.
How can I make sure it is in the foreground?
Just immediately after navigating to your test URL, Maximize and Switch To the new window. It will come in the fore ground (provided you don't interfere with your mouse ;)
browser.navigate().to(test_URL);
browser.manage().window().maximize();
browser.switchTo().window(browser.getWindowHandle());
Finally I found the answer from one of the post, it worked for me, URL:
Bring the Firefox Browser to Front using selenium Java (Mac OSX)

Selenium, WebDriver for Chrome Stopping the window opening

When using the WebDriver driver for Chrome a chrome window opens, and navigates to the specified page.
Is there a way to stop the window from opening?
Edit: I am using it to scrape the web page so there is no need for me to see the actual webpage. The desired behaviour would be that the scraping would be done "Silently"?
What you are talking about is called a headless browser.
You have several options to choose from:
fake a display and let selenium and a browser think you have a real one. See xvfb.
use PhantomJS browser
run your tests against BrowserStack or SauceLabs selenium servers (or have your own one)
See also:
Selenium Headless Automated Testing in Ubuntu
Getting Started with GhostDriver & PhantomJs

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