UI automation code for Optimizely test - java

I am new to Optimizely A/B testing. My question is, I have automation code of test cases for UI and if someone changes the UI using Optimizely, How can I make sure my automation code of test cases doesn't break because of those new changes from Optimizely ??

You basically can't; Optimizely is code injection. It's the responsibility of whoever's monkey-patching the UI not to break it.

If you've got something like Selenium or Ghost Inspector checking things on an actual running website using URL's as a target, you can just opt-out of Optimizely tests for the purposes of verifying your UI. To do that add optimizely_disable=true or optimizely_opt_out=true as a query parameter to the URL's you're checking. i.e. http://youramazingsite.com?optimizely_disable=true

Related

How to add a button in FitNesse Test case?

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.

Is it possible to automate captcha code using selenium webdriver?

I'm automating this irctc site as hands on selenium webdriver.
It is asking me for captcha code along with username and password. Is there anyway to automate the captcha code?
You obviously failed to understand what CAPTCHA is; from WikiPedia:
A CAPTCHA (a backronym for "Completely Automated Public Turing test to tell Computers and Humans Apart") is a type of challenge-response test used in computing to determine whether or not the user is human.
As was already mentioned in other answers and comments, there are several possible attacks to defeat this. You can get links to several other options from the same WikiPedia page. But note that all of these are more of a proof-of-concept, rather than an out-of-the-box solution.
Since you tagged your question with Selenium, it is possible that you may be using this in an environment that you control, such as test environment at your work. In such a scenario, the easiest solution is to ask your developers to introduce a "test" flag for any non-production deployments. When this flag is active, a predefined phrase will always pass the CAPTCHA for testing purposes. However, you should still have a full-pass test, with everything turned on as if real production.
1.try import this javasc ocr lib or other ocr lib. https://github.com/antimatter15/ocrad.js
2.read the result and pick only upper case char
There is no proper way to automate captcha using Selenium WebDriver.
The only way to run an automated test script involving captcha is to have sufficient delay when the captcha appears so that a human can enter it on the field provided.

Sharing browser automation scripts without client side installation

I want to write a browser automation script which can be used by others to perform their mundane tasks easily. For example, a script that will login to a site using provided credentials, select few products ( passed as parameter) and put them into the cart and checkout automatically.
I would like to keep the end-user installation easy and light. Don't want the end user (who is not tech-savy) to download and setup anything.
I had tried Selenium webdriver in Java for this. The script part works perfect for the requirement but asking the end user to install and set up JAVA, etc is not possible.
Would like to know if there is any simple way to achieve this. Preferably an open source solution, but not necessary. Goal is ease of setup and use for the end user.
Can anything similar be done for Android also?

Automating multiple form submissions with Liferay Portal and Selenium

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/

Selenium RC and Internet Explorer

I am trying to create a fully-automated test suite for a web application, using Selenium RC and test cases written in Java. However, I have encountered a few problems that I have not been able to solve. Please let me know if you have a suggestion about any of these issues.
Single window mode. I would like to run single window mode because I think it will provide a significant performance improvement, and probably solve problem 2. I am able to run my test cases in single window mode with Firefox and everything works as expected, with much faster execution. However, I have not been able to get my test cases to execute when using single window mode with Internet Explorer; button clicks do not work at all, so the tests fail due to the browser never advancing to the next screen. The exact same test case executes fine in multi-window Internet Explorer. Is there some kind of trick I can use to get this working?
When running in multi-window mode, if there is an error in the test, or if the user exits the Selenium GUI window, the browser never closes. I know that it is possible to get the process id and kill it, but this seems rather dangerous, especially if the user is running multiple instances of the browser. This is part of the reason that I would like to use single window mode, if possible. Is there some other way, possibly by handling the window close event for the Selenium GUI, to solve this?
I am unable to use the waitForPageToLoad command in any of my test scripts because it will never recognize that the page has loaded and resume execution. I think this is because the pages use Javascript, but I am not sure; I don't have too much experience in webpage development. Right now, I am using the wait command and specifying the amount of time to wait. However, this is very unreliable, sometimes if the Internet connection is slow, my tests fail because the wait times are not long enough. Other times the tests are excessively slow, due to long wait times. Any ideas for how to handle this problem?
Thank you! I appreciate any answers or suggestions you can give. Please let me know if you would like some more information.
For multi widow close issue, you need to handle the exceptions. Call the close function in the finally block will resolve the window close issue.
For Page refresh, you need to check that manually and call in correct places. Usually clicking on links will cause page refresh before showing next screen.
Have you tried IE HTA mode? When I used to mess with this stuff it was the only reliable way to run tests on IE.
Not sure
You need to use the wait class. In essence you make an action then poll on an element which isn't present yet but you know will be when its safe to continue with the test. So you only ever wait the minimum time needed.

Categories

Resources