Tag Info

Hot answers tagged

3

For really good, robust, maintainable UI automated regression, you need code. Using screenshots is bad for several reasons: Even with a fuzz tolerance built in to prevent things like the exact color of the display throwing false positives, there are too many trivial things that can throw a false positive. A change of display resolution will utterly destroy ...


2

driver.findElements(By.name("vehicle").click(); int i = 0; for (WebElement we:driver.findElements(By.name("vehicle")) { if (we.isSelected()) { i++; } } System.out.println(i + " Number of check boxes present in the page"); That should give no issues. But you are looping through an entire list to always come to the same answer, 1.


2

I'm no wizard when it comes to actually coding this, but I used to inject variables with JS into Selenium IDE (back in the day) that would collect certain actions a they were performed. Perhaps you can use the action for clicking the checkbox to increase a simple count variable to use in your script above?


2

Explicit and Implicit Waits wait.until(condition) waitForElementPresent(locator) driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); More information here: Advanced Webdriver Usage with "implicit waits"


1

WGet is a command-line tool used to download files. Here's a good tutorial on how it works; you'll need to call out to the command line from inside your test and execute wGet, then check the file it downloaded. How you do this differs depending on your setup (Java vs C#, Windows vs Linux, et cetera). Basically you want to execute the command wget ...


1

Three possibilities: The IDE inputs (e.g. arguments and environment variables) are not the same as the command line inputs. You can check that with print statements or logging. The libraries are not the same. I assume you know how to check this. You found a timing problem. To check this, first determine which element is erroring out, then try waiting ...


1

I often put common helper code into a base class. Mostly I do that only for "general purpose" helper code, like logging in, starting and stopping Selenium, dependency injection, and stuff like that. For helper code related to functionality (like selecting or searching or purchasing flights), I always put that not in a base class, but in a delegate class. ...


1

There are two parts to this. The first is that you need to be sure that your xPath is correct. One way to validate that is to use a tool like Firefinder (a firefox extension for firebug). Navigate to your page and be sure the element you need is present and then hit f12 and go to the FireFinder section. Enter in the xpath you are using and see if it can ...


1

Can you find it if you use the .Text and then clicking it if it matches? String Expectedtext = "Procurement" String ProcurementButtonText = driver.FindElement(By.XPath("//td")).Text; if (ProcurementButtonText == Expectedtext) { driver.FindElement(By.XPath("//td")).click() }



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