I'm writing a series of tests with Robot Framework, that involve the supposed user closing the web browser (Chrome) during a session of the tested web-service and then re-opening the browser, automatically resuming the session.
My issue is, that with the Close Browser - Open Browser -combination in Robot Framework a fresh browser is always opened every time, and thus the user is logged out of the service and session is ended.
I tried getting and adding the cookies with the built-in Selenium keywords, but I was unable to resume the session that way. Doing the task manually works as intended.
Apparently it is not possible to attach Selenium to an existing browser session created launched for example by a custom Python keyword.
Is this something that is possible in Robot Framework and what kind of solution should I look for? Thank you.
Related
I'm trying to understand the performance impacts of things like WebDriver.findBy(...). For example if I was using Selenium to drive a local Chrome instance:
WebElement betty = webDriver.findBy(By.id("betty"));
Does the Selenium library
a) have the DOM within the JVM to evaluate?
b) go to the local Chrome driver binary to evaluate?
c) go to the browser instance to evaluate?
And does the answer change for a Grid situation?
I found a nice technical guide that explains this.
The browser driver uses an HTTP SERVER which waits continuously for
new Selenium commands.
It has the following purposes:
read HTTP requests coming from the client (client = computer that executes the test automation scripts)
determines the series of steps needed for implementing the Selenium command
sends the implementation steps to the browser
gets the execution status from the browser
send the execution status back to the client
For each Selenium command of the automation script, a http request with a specific path is created.
When the automation script is executed, the first http request generates a new session that is specific to the browser where the automation scripts run.
The session id will be used for the http requests that correspond to all other
Selenium commands from the automation script.
I'm testing a website which uses cookies for security. Every time a user logs in with a different device or browser they must go through an intensive (email and phone keys) identity verification process. My backup/restore process uses a Firefox addon and works for manual testing.
However when I run Selenium I get triggered to go through the ID process every time. So either Selenium is not using the cookies, or is being given a different browser ID for some reason.
I set a breakpoint to check my cookies are loaded in the Selenium Firefox browser window, but my addon is not available in Selenium Firefox instances.
Selenium documentation is very slim on cookie use:
http://www.seleniumhq.org/docs/03_webdriver.jsp
So any info much appreciated.
There are many selenium webdriver binding package of Golang.
However, I don't want to control browser throught server.
How can I control browser with Golang and selenium without selenium server?
You can try github.com/fedesog/webdriver which says in its documentation:
This is a pure go library and doesn't require a running Selenium driver.
I would characterize the Selenium webdriver as a client rather than a server. Caveat: I have used the Selenium webdriver (Chrome version) from .Net and I am assuming it is similar for Go.
The way Selenium works is that you will launch an instance of it from within code, and it creates a live version of the selected browser (i.e. Chrome) and your program retains control over it. Then you write code to tell the browser to navigate to a page, inspect the response, and interact with the browser by filling out form data, clicking on buttons, etc. You can see what is happening on the browser as the code runs, so it is easy to troubleshoot when the interaction doesn't go as planned.
I have used Selenium to upload tens of thousands of records to a website that has no API and only a graphical user interface. Give it a chance.
We would love to adopt Nightwatch.js for testing on browsers, but we're stuck on one major caveat: at the time of this writing, Nightwatchjs does not support running different tests using the same browser session. In short, it means that:
Creating the browser session is handled by the Nightwatch module from lib/index.js, in the startSession function;
Killing the browser would correspond to the delete command place in the Selenium action queue in the terminate function of that module;
A new Nightwatch client is created at every test run, which happens every time we load a different test file;
According to this source, it is possible to reuse the current browser session in Selenium, instead of opening a new window.
Has anyone managed to fix this problem in Nightwatch?
Here's the feature request on Github, which was requested on Mar 31, 2014 and is still open.
Another approach would be to circumvent the problem altogether by getting Nightwatch to merge all different files into one Test Suite, but that seems to be harder to solve than the problem with sessions...
Nightwatch now has support for resuing browser sessions. You can simply use the flag --reuse-browser to reuse sessions while running your nightwatch tests.
We have pages where we occasionally see compromised SSL certificate because of third party scripts that load non HTTPS resources (Initially they're fine but they occasionally change). We would like to test those pages for broken SSL every day.
We have tried one approach, attempting to catch a pop-up message that would indicate that we have insecure content on the page. However, we have been unsuccessful in simulating the pop-up message through selenium. It appears that selenium has automatically disabled any popups. While we have identified a Selenium method to disable the suppression of the pop-ups(disable-popup-handler) but we have not been able to successfully see the popup even using this method.
Has anyone found a way to detect broken SSL pages using Selenium?
You need to load a browser profile (with WebDriver) that doesn't have the setting for popup blocker enabled (using the Profile class and giving it the right properties). Then, you will get the Windows popup message concerning the SSL cert. If , for some reason, you cannot control the popup using WebDriver (because its limited to Action control only within the browser content window) then you can use Sikuli API to handle the dialog and export the cert to the "Downloads" dir and then copy the file to expected location for inspection. Unfortunately, if you use Sikuli, that will make your automation script sequential and not work via a RemoteWebDriver grid server and so you wont be able to run parallel tests. Hopfully, WebDriver gives you access to the dialog and so you will be able to run with RemoteWebDriver because that is the best way to go when running scripts, even if you run a browser locally.