I would like to test a button click event of a web page in different tabs of browser.
Let's say I have button named as Save Details in URL: http://example.org/UserDetails
Now I open the same URL in two different tabs in Chrome browser window.
I would like to click Save Details button in different tabs at same time. How is this possible ? Can I do this using selenium tool ?
Being a ASP.NET developer , I am new to testing tools. Any help would be great.
Update:
I want to simulate users clicking the same button in different browser or same browser different window at same time.
Selenium is just an FT tool and it can perform single operation just like humans at a time on a webelement in non parallel run. So, at the same time it cannot perform click operation on two different tabs in same browser window.
For your use case, you need to depend on any other framework like TestNG along with selenium. TestNG has parallel run feature which allows you to trigger multiple test case at the same time. So, in your scenario, the same test case needs to be defined twice or can be duplicated and include both the test case in Testng.xml from where execution triggers. And also ensure that you include below attributes in testng.xml
<suite name="TestSuite" thread-count="2" parallel="methods" >
Thread-count - number of instances which you wish to open
Parllel - Indicates that the run should be parllel
In this run, there will be 2 browsers invoked at same time and two test cases(duplicated) will be executed in each browser. It cannot execute in two different tabs, it will be in two different windows
And also please note that it may not be accurate and there may be a difference of fraction of seconds due to network latency and machine performance
Related
I'm trying out FuncUnit with a simple login/logout script for an app, using Chrome on Windows 7. I've noticed that both the speed and reliability of the test differ depending on if the test is running in the currently selected tab in Chrome.
If the tab isn't selected, the test runs quickly and without error. If the tab is selected, text is typed slowly and sometimes incompletely (so only half the password will be typed before the submit button is clicked), clearly visible elements fail to be found and the test has about a 50% success rate.
Am I missing something here? It's proving less reliable than even QTP unless I deliberately deselect the loaded tab and I'm dubious about any automated test that needs user interaction to pass reliably.
Turned out to be a Chrome version specific issue
I am currently working on a project which has few Id's in the first screen and depending on the Id selected, user is navigated to second page which displays respective Id's information. All the information displayed is retrieved from SQL database.
Here is my question how can I automate this using Selenium.
Thanks in advance
If you have a coding background I would suggest writing some basic automated tests with Selenium WebDriver. This will allow you to find elements on the page via their ids, get text from textfields, click on links, and verify that another page has loaded (sounds like the tasks you wish to perform?). You can structure your tests so they run through the main functionality path (eg. go from log in, to main screen, to another screen, testing all functionality along the way) and then you will only have to write a few tests. If you want full automation it is usually better to have specific requirements for your application and write a separate test for each. The Selenium homepage has some good documentation with code snippets to get you started, and a simple google search should provide you with several tutorials. Good luck :)
I want to create tests with Selenium IDE for SharePoint 2010. I set the control in Selenium IDE to slow, but it is often to fast and the test fails because javascripts are loading etc.
Is there a way to slow down the script?
I had best results using functions like waitForElementPresent or waitForVisible. This way you can just wait for specific element you want to work with. For example if you click link Next and want to click Previous when page reloads, instead of writing andWait abbreviation you could use something like this:
waitForElementPresent(Previous)
click(Previous)
Aside from placing pause(waitTime) between your statements, I would recommend to transition the IDE scripts to Selenium RC and use the selenium.setSpeed("milliseconds"); statement (java) to control the execution speed.
Using pauses means your tests are going to pass while your server is under the same load but they will start failing as soon as your server is under heavier load.
You should use the clickAndWait command, which waits for the next page to load before continuing with anymore commands.
click/clickAndWait - performs a click operation, and optionally waits for a new page to load.
waitForPageToLoad - pauses execution until an expected new page loads. Called automatically when clickAndWait is used.
Reference
Put this after your click commands: pause(length of time in ms)
For example:
pause(1000)
This pauses for 1 second. Start with a higher value until it works, then work your way down to find the smallest possible pause.
You can set the speed of each step with Selenium IDE
Command Target
setSpeed 65 (set the speed of item)
setSpeed 0 (reset the speed)
In order to automate DOH tests during our build process, I use Selenium RC to launch different browsers (IE and Firefox) on a server placed on a different domain than the build machine. Each browser is directed to our runTests.html in order to start DOH.
Sometimes, when a test that uses doh.robot starts, the following message is shown:
"DOH has detected that the current web page is attempting to access DOH, but belongs to a different domain than the one you agreed to let DOH automate. If you did not intend to start a new DOH test by visiting this Web page, press Cancel now and leave the Web page"
but since these tests are unattended it just sits there waiting for someone to click OK, and Selenium times out (in IE 8 it seems like the pop-up disappears automatically but the robot does nothing afterward).
As I said, it doesn't always happen. After you click OK on the Pop-up, the message will stop showing, and the message can go away for several sessions, but then it will show again in which seems to be an arbitrary way.
Does anyone knows a way to prevent this pop-up from showing?
This is probably not the correct way to do it, but in util/doh/robot/DOHRobot.java, you may be able to modify the code to not check that or always simulate pressing "OK". I haven't tried it myself, but I may also need to do that for some of our automated testing.
When the DOH robot is initialized, it first tries to click in the upper left corner of the page you are trying to test. If you obscure this div (you can see it with firebug), then the message will pop up. I think the problem is that your page isn't always loading up quick enough.
It is somewhat of a challenge to fix this. I haven't used DOH in awhile, but I don't think there is any way you can use a setTimeout to fix this. (You can try using setTimeout on the doh.run command, but it might be the case that the DOH robot clicks that div before parsing any doh commands.)
Another thing you might be able to do is add a sort of "wait" command to Selenium, or whatever shell command you are using to fire up the system.
I am using selenium for one for my Java applications on linux. The application invokes a mozilla browser, fills login details (username and password), and then submits the form. I am able to achieve this using selenium, but every time a url is selected 2 instances of mozilla is getting invoked. One instance is that of the url selected and the other instance is a RemoteRunner.html which has selenium command history and other details.
I don't want this page to be invoked. Is there a way to stop this page from getting invoked?
Thanks and Regards,
Sunil.
The RemoteRunner window is required as it is controlling the application under test within the other window. You can run Selenium in a single window using the command line option multiWindow=false however this uses frames, which can sometimes cause issues with the application under test.