Tag Info

Hot answers tagged

9

Strictly speaking you don't need to know how databases work to work with any automation tool. But without an understanding of databases and the ability to query them, you block off a large source of extra information you can use for validation. Some examples: Your application takes a person's name and contact details and stores them in three tables (for ...


6

Selenium is a tool that remote-controls a browser. You can use it to simulate a user interacting with a web site. JUnit is a framework for writing Java unit tests. It takes some of the grunt work out of organizing tests and generating reports. You can express each test as a method on a class; typically, you have multiple tests per class. JUnit will run ...


4

Take the screenshot in the @After test tear down method, which is run after every test. This way you will always get a screenshot for both passed and failed tests. public class TestSample { static WebDriver driver; @Before public void setUp() { //start new webdriver session, for eg using firefox driver = new FirefoxDriver(); ...


4

Not everyone on the team needs the same skills, and if you already have enough development capacity you might be more valuable for the overall results if you take up other tasks. When working together with testers in an automation project, developers can focus on the development part if there is someone else who: Really understands the application and the ...


4

If your using Java, here is the JavaDoc If your using Ruby, here is the Ruby Docs If your using Python, here is the Python Docs If your using .Net, here is the .Net docs This will contain all of the functions that Selenium uses.


4

You can use the findElements method to find all TD tags that match your criteria, and then getText method to retrieve each element's value. The latter will be returned as a String, so you may need to convert it to a number before comparing it. Since the sorted elements have a special class, you may want to use a CSS selector with findElements.


3

I don't see why this couldn't be done if you have a code driven Selenium test suite. You would need to implement a method run on test failure that adds a bug to Bugzilla using their HTTP REST API. For the first step, if you are using Java, see this answer on taking a screenshot when selenium fails and the referenced blog post. You need to similarily ...


3

Depending on your project you may also assert visual consistency, for example in a website that shows breadcrumbs the level of nesting should be consistent with the displayed breadcrumbs. Maybe a 'minimum width' for buttons/text inputs/etc. You may also probe performance and measure how fast is the site loading. Whether these are expected of you or not is ...


3

I understand you have problems with test automation because you are not much skilled (yet) in programming. And it hurts. I believe the more something hurts, the more resistance something offers, the more you need to practice that until the moment things become a routine for you and you become more effective. There are no workarounds and shortcuts to master ...


3

No, Selenium 2 / WebDriver is for web applications only. But there are other tools to automate desktop application GUI tests. http://en.wikipedia.org/wiki/List_of_GUI_testing_tools You can also search for "desktop application" on this site to find recommended tools.


3

Some people may prefer to use a new Driver instance for every test in order to avoid one test's side-effects from impacting another test. I have never run into that problem. For efficiency reasons, I try to re-use a single Driver for all tests in a suite.


3

Browsermob-proxy could be used to blacklist the GA hosts, so the code isn't even loaded. https://github.com/lightbody/browsermob-proxy It integrates well with Selenium. Here is a general purpose talk describing using BMP to blacklist cruft that can slow down automation (Facebook & Twitter widgets are specifically mentioned, but I'm sure GA can also ...


3

type void type(java.lang.String locator, java.lang.String value) Sets the value of an input field, as though you typed it in. Inputs the value. Sets the textfield to the value, nothing special. It just takes the entire string and puts it in there at one time. typeKeys void typeKeys(java.lang.String locator, java.lang.String value) ...


3

For testing it, your doing an extremely basic test. A major advantage of automation is that you can do a lot more testing. I would set up a datasource for names, declare them valid or invalid, and have it attempt to use it. I would also have it only use one of the special characters at a time and the rest be valid (As of now your essentially testing if any ...


3

The actual slider is a link-element you should be able to define a css selector based on its classes. <a class="ui-slider-handle ui-state-default ui-corner-all" href="#"></a> The first you find is the left slider, the second the right slider. I have successfully used use the Action Builder and the MoveToOffsetAction to drag a slider X number ...


2

CSS selectors can also match strings that start with, end with, or contain a certain substring. For example input[id^="E_DOS_TITEL"] will match an input element whose id attribute starts with the text E_DOS_TITEL. The ends with comparison operator is $=, and contains is *=. The example provided above should work as long as it's the only input element ...


2

I know you can do this using Appium and launching the Chrome browser app. The set up is quite a bit more then selenium AndroidDriver. I have gotten pretty close to doing it. If your developing on windows, one hurdle is the framework seems to be written and maintained by all Mac users so the windows support and documentation is quite scarce. Also you will ...


2

You didn't say whether you were using Ant or something else. I will assume you are more interested in the "positive and negative" part of the question than how to invoke the JUnit test runner from your build tool. You can register a TestWatcher to monitor what happens during a test run. The JUnit test runner will invoke methods on the TestWatcher when ...


2

If you can't determine why the browser won't launch, you can make your tests more robust. Make sure to clean the environment during test warmup, add some retry/wait/timeout wrappers around the section that launches the browser, and kill any processes and services that aren't relevant to the test. In order to find out why the browser is crashing, you can ...


2

As much as possible, please avoid using absolute xpaths, any small change in the page layouts and your xpaths may become completely useless, as much as possible, use the class names, ids etc... For the gmail sign-in, //div[@class='signin-box']//div[@class='email-div']//input[@id='Email'] is the xpath for the UserName Text field, likewise for the ...


2

Agree with User246 and here is an example of how to do: protected WebDriver getWebDriver() { if (driver == null) { driver = new InternetExplorerDriver(); } return driver; }


2

Typically HTML IDs are unique; if you know the ID, you do not need to know the element tag. Of course it is possible to write a web page that uses duplicate IDs. If your web page has duplicate IDs, you should complain to the developer. For the rest of my answer, I will assume unique IDs. According to this, XPath doesn't actually know anything about CSS ...


2

A Sleep method is almost always the least acceptable way to synchronize an automated test. A better approach might be to register an event and check the event is raised when in the desired state, or use a polling loop which will can enable the test to proceed when the system is ready (e.g. an element id appears), or a timeout occurs if it takes more than a ...


2

What kind of hidden objects are you looking for? If it's any HTML tags with the attribute display: none; try using List<WebElement> elements = driver.findElements(By.cssSelector("[display=none]")); int count = elements.size(); This uses CSS matching to find all HTML elements with the display attribute equal to none. Then get the size of the returned ...


2

To add to gomesr's answer, you might find yourself needing to wait for other elements during your tests. One way to easily have reusable code for this is to use a closure (also known as an anonymous function or a lambda function) to create a spinner function that you can call whenever you're waiting for an element to load. The spinner function would look ...


2

Create function AdminLogin Create into each test class method SetUp (doc) Call admin_login by SetUp Looks like: protected function setUp() { AdminLogin(); } This method calls before each test into test class Good luck!


2

Well the reason you are getting so many different matched is because you print it as you go through the loop. My personal suggestion, I like the KISS method, change the code to something like the following: public class Ex1 { private WebDriver d; @Test public void testUntitled() throws Exception { d = new FirefoxDriver(); ...


2

You can use the following code also to handle popup. String mainwindow = driver.getWindowHandle(); for (String popup : driver.getWindowHandles()){ driver.switchTo().window(popup); } // Your code on poppup window driver.switchTo().window(mainwindow); //Switching to main/parent window Hope this will help :)


2

If this is a Javascript alert box, this is relatively straightforward; you can switch to it with driver.switchTo().alert(); in Java. If you save the return value of that as an Alert object, you can interact with it, like alert.accept(). See the javadoc for more information. Since you're asking, however, I suspect it's not so simple. If this is not really an ...


2

Both Saucelabs and TestingBot provide a service which records your Selenium tests if you run them against their Selenium Grid. Both offer a number of free minutes per month, which might suffice your needs. You can view/download the video's straight after the test run is finished. Although I don't know how their setup works, I think I can give you some ...



Only top voted, non community-wiki answers of a minimum length are eligible