My Selenium test clicks on some elements of a page and executes javascript. How can I time this entire workflow? I am not testing the page load speed but rather how fast Selenium finishes execution of all the tasks I give it. I am using Java.
The easiest (and most thorough) out of the box solution is to use Selenide, which has a really nice (undocumented) feature that is able to give timings of page loads and components in a page. But, you could add your own timer events to the Configuration methods of a JUnit or TestNG test. Take this page as an example: How can we get exact time to load a page using Selenium WebDriver?
Related
The scenario is as follow:
I want to pause the test when it encounters the Button in the Wiki page Test Scenario. It should wait until the user presses the Button and once the button is pressed the test should continue.
As the automated tests are designed to run in a full set without any monitoring or midway user interaction, this is not a standard feature. Feel free to edit the source where needed and recompile.
Since you tagged this question with Selenium-fitnesse-bridge, my assumption is that you are testing the browser user interface of an application via Selenium webDriver, but instead of driving the tests from xUnit you are driving from fitnesse.
First, this isn't really the sweet spot of fitnesse - it's main purpose is to test business logic by interacting with System Under Test as opposed to running end-end tests by driving a browser - however, that soap box aside, you are creating fixtures for fitnesse to interact with - and those fixtures currently contain webdriver code. So you can put the pause inside your fixture class. I'd need to see your test table and whether you are using Slim or not to get an idea of where the logical place in your fixture code to place the wait would be.
The only problem with that solution is if you want to specify on the fixture page that there should be a wait at a certain point - you don't just want it behind the scenes in the webdriver code. In that case, you could probably use a ScriptTable style of fixture (http://www.fitnesse.org/FitNesse.UserGuide.WritingAcceptanceTests.SliM.ScriptTable) and have a command in the script that maps to a method that waits for the specified amount of time or for a specified element to be visible.
I am trying to run the test again in the same browser tab when it is completed where it leaves the page. Basically, my intention is to test the site on multiple languages that can be selected through a drop down.
Also, I use Browserstack to automate it.
The below listed code will enable me to select next drop down item each time when test is completed.
driver.findElement(By.xpath(".//*[#id='trigger']/div/paper-input/paper-input-container")).click();
Thread.sleep(1000);
driver.findElement(By.cssSelector(".style-scope.making-language-selector.iron-selected.x-scope.paper-item-0")).click();
driver.findElement(By.cssSelector(".style-scope.making-language-selector.iron-selected.x-scope.paper-item-0")).sendKeys(Keys.ARROW_DOWN, Keys.ENTER);
I did not use any frameworks to implement it.
Thanks in advance,
I have written the Selenium webdriver java code to automate the test and its working fine. But I have lot of data input to test my web and it takes time. So when i minimize the IE to do some other task while it is running the automation, it is throwing error:
org.openqa.selenium.ElementNotVisibleException: Element is not displayed
Selenium WebDriver is trying to simulate "real" users interaction with the webpage. If a person can't click on a button not currently displayed, neither can Selenium.
ElementNotVisibleException occurs when the element you want to interact with is not displayed. When you minimize the browser some of the elements are no longer visible, even though they where in maximized window.
You can add scroll using moveToElement() from Actions class every time you want to perform any action (I don't recommend it, you increase significantly the chance for errors), or find another hardware solution, like plugging in another screen, run the test on another computer etc.
According to my experience, the Internet Explorer WebDriver is very oversensitive when it comes to disturbances from a real user while running test cases. It's better to not touch anything at all. ;-)
Try Chrome! This is much more robust and also faster.
Selenium script runs as a simulator. You cannot do another work when script is running. Chrome is fast but while running script in chrome you can not do other task like any other browser. If you minimize window, you will get exception "ElementNotVisible".
I have a ui test that uses selenium chrome driver. I want to set the form filling speed to be slower. I have googled but couldn't see how.
Does someone know how to do this?
In Selenium 1 you can use setSpeed method, in Selenium 2 (aka WebDriver) is, unfortunately, no option like this, at best you can use Implicit waits. However is not really recommended to slow down the Selenium for all tests, you should add waits only for tests which really need to wait for some action to complete.
I've had a whale of a time attempting to figure this out, considering the limited documentation that I can find outside of the API itself.
I have a liferay portlet that simply clicks on a button, pops up a form with a bunch of fields, and then submits that form.
I want to use Selenium (or really any automation tool that can do this with Liferay) to similuate 100-500 concurrent submissions.
Has anyone used Selenium with LifeRay in a similar manner?
Selenium is a good tool to test the correctness of you web system, NOT to test the permormace of this system. For Stress testing you should use another tool, like JMeter http://jmeter.apache.org/ . Or you can code test script with HtmlUnit http://htmlunit.sourceforge.net/