Protractor, Javascript: How to kill all existing browsers - protractor

I am writing an application for end to end testing using Protractor for an angular 2 application.
Before starting my application I would like to close all browsers that may be running on my machine. e.g. when I am running my test in chrome, I want to close all chrome processes/instances before my test starts.
So, looking for something that I may call in beforeLaunch method of protractor config. (please let me know if there is a better place to call it with the answer of how to do it)

Related

Does Katalon support opening webUI and mobile driver in same script

We want to execute a automation test case wherein first operations will happen on WebUI and then it will switch to Mobile execution. The process will be done sequentially. I want to write all script in one testcase itself. First script will execute on Chrome browser then in connected mobile device.I am looking for someone who has achieved this in katalon. I need a solution other than test suite collection.
This can be done by using profiles in katalon :
https://docs.katalon.com/katalon-studio/docs/execution-profile-v54.html
Please also remeber that this is not only profilesbut also enviroment (chrome or mobile). You can use this Execution window as example what eviroment i am talking about.

Get WebdriverIO multi-remote to work with Cucumber BDD

I am able to start multiple browser sessions in a single test using WebDriverIO's multiremote with mocha.
Next I'm trying to get WebDriverIO multiremote work with Cucumber BDD. My feature definition is simply to open a browser session and navigate to a url.
Here's my simple WDIO
Problem - the browser opens up but navigation does not occur. I have tried to enable the debugger and observe node-inspector but hasn't helped. What am I missing? Thanks for all the help.
My goal was to conduct multi-user scenario based testing through BDD. Although I haven't been able to resolve this directly via WebDriverIO I found Chimp (which uses WebDriverIO underneath) has its own flavour of session based automation.
Chimp's multi-browser testing does exactly what I wanted. Problem solved!
I'm able to write scenarios such as this without explicitly switching the user context.
Scenario: Able to browse independently
Given Alice goes to "/features"
And Bob go to "/bugs"
Then Alice sees "10" features
And Bob sees "1" bugs

GWT Selenium Tests sometimes fails

we currently have a nice problem with our selenium tests in a gwt powered gui.
The application contains two sections (filter and grid). Our tests sometimes fails with a NoSuchElementException.
Crazy is the following: I stop the test in eclipse with a breakpoint and inspect the page with firefox firebug or any other addon. And okay - I cannot find the desired element. But (without restarting the application or any other changes in eclipse), if i try again and search the element it is there and a resume in eclipse the test goes green. For me it seems like a synchronize problem in firefox.
A explicitly wait command
new WebDriverWait(getDriver(), 10).until(condition);
has the only effect, that the timeout (10 seconds) happens.
As I said - sometimes the test is green and sometimes it fails.
Has anybody an idea?
Sounds like you load some data asynchronous (RPC) from the server? The data and thus the element which presents the data in the UI is not there yet, when Selenium is looking for it. Depending on how long your queries take on the database or what latency you have on the network the wait time may vary from test-run to test-run.
I have a workaround for this problem and would share this.
The following piece of code is executed before the explicit wait command is running.
Window window = getDriver().manage().window();
Dimension dimension = window.getSize();
Dimension tmp = new Dimension(dimension.getWidth() - 1, dimension.getHeight());
window.setSize(tmp);
window.setSize(dimension);
I figured out, that the DOM is in "synchronized" state after the browser window is resized. So I decrement the width and than set it back to the old value.
If anybody has a better suggestion - let us know ;-)

Using Turbolinks with Selenium IDE

When I run my selenium test without the turbolinks gem installed in my Ruby on Rails app, the tests pass. When I include turbolinks, the tests fail. For example if the test starts off
Open /
clickAndWait link=Sign in
type id=session_email any#example.com
Then I will get an error
"[error]Element id=session_email not found.
When I look at the page source, the session_email id is still there with turbolinks installed. I found this page, http://www.digitalkingdom.org/rlp/tiki-index.php?page=Selenium+And+Javascript, which seems to indicate there could be a problem with detecting the page has fully loaded.
Is there away to fix this without changing hundreds of lines in my test suites? If not, is there a reliable selenium method that can test that a turbolinked page has fully loaded?
After some help with the github turbolinks-compatability project, I am able to provide a partial answer to this question.
If the turbolinks gem is being used, then you will need to modify your selenium test cases in order to make sure the page is really loaded. For example, if your test has the following code in it
Open /
clickAndWait link=Sign in
type id=session_email any#example.com
then it needs to be modified to
Open /
click link=Sign in
waitForElementPresent id=session_email
type id=session_email any#example.com
There are a number of "waitFor" modifiers you can used, depending on what is the feature on the page you want to test next.
However, if the test involves a javascript pop up, then you should not add a waitFor command. So for example if you have at test like
clickAndWait link=Delete
assertConfirmation Are you Sure?
you should not modify the code. Indeed adding a waitFor test hangs execution in the case of javascript popups.
This solution involves line-by-line manual modification of the code. I have opened up an issue on the Selenium Users group to see if there is some better way to handle this problem.

Does selenium support IE with google frame add on installed on it?

Selenium is able to load Chrome Frame pages. The problem is that once you load the page in IE with Chrome Frame plugin, the tag appears as empty. Selenium tries to identify elements using the DOM structure, but the way IE and Chrome Frame plugin works, rendering
and DOM tree are taken over by the Chromium code and IE gets an empty DOM.
So i guess, selenium doesn't support IE with google frame add-on installed on it?
Has anyone worked around this problem?
Thanks
This question has been asked and answered on the Selenium user's mailing list. The IE driver doesn't work with the Google Chrome Frame add-on, and there are no plans to implement support for it to work with the Chrome Frame add-on. Either you want to test the operation of your website under Chrome (in which case you should use the ChromeDriver), or you want to test it under IE (in which case you should use the IE driver). If you can point to a specific case where using the website with the Chrome Frame add-on behaves differently than the way it behaves with the Chrome standalone browser, you might be able to make a case to revisit the issue. Furthermore, remember that Selenium is an Open Source project, and you are welcome to make changes and submit patches to the code at any time.
Watir WebDriver has the same issue.
Selenium core, the part that loads in the target browser and executes tests does work and can be run independently. So, if you have a Selenium test suite in HTML form, it can be run in GCF using the following steps:
Configure a web server to opt all URLs into chrome frame using HTTP header as described here: http://www.chromium.org/developers/how-tos/chrome-frame-getting-started#TOC-Making-Your-Pages-Work-With-Google-
Host your test suite under '/tests' folder on this web server. Lets say the suite is my_test_suite.html.
Host the selenium core folder as the '/core' on the server
Now restart the server.
Run the suite with this URL: http:///core/TestRunner.html?test=tests/my_test_suite.html&auto=true