Tag Info

Hot answers tagged

4

Try to use driver.findElements instead. It returns a list of all WebElements. All means also the not visible elements. Here some code to iterate thru the list and only do something with the displayed items. List<WebElement> elements = driver.findElements(By.className("vfmThumbnail")); java.util.Iterator<WebElement> i = elements.iterator(); ...


3

Yes, use soft assertions org.testng.asserts.SoftAssert. Soft assertions are assertions that do not terminate the test when they fail but results are included in the test execution report. More articles on that topic: http://stackoverflow.com/questions/19091526/how-soft-assertions-work ...


3

List cheeses = driver.findElements(By.className("cheese")); findElements() does not wait, but returns list of elements (located by locator). List is empty if nothing is found. http://docs.seleniumhq.org/docs/03_webdriver.jsp


3

You can click text. It just (usually) doesn't DO anything. Everything that exists CAN be clicked -- you can move your pointer over it and click the mouse. Whether the application does anything with that click event is up to the logic behind the page, which Selenium can't help you with because it doesn't know how your application works. An example with ...


2

Your password example is a classic example in favor of automation, once you have the infrastructure for entering a password and detecting rejection adding more cases should be simple and cost effective. You use the term Negative Testing to describe a type of scenario, but keep in mind that it is functional the same way as any other sunny day scenario, ...


2

It doesn't matter so much what you'll be automating, rather why. Are these negative tests included in your regression sets? Are these tests executed manually every time you run your automated scenarios? Will it eventually save the test team time and resources should it be automated? Seeing that testing frameworks can usually deal with expected errors, ...


2

TestNG has a feature called soft assert. This kind of assert doesn't stop the test when assert is failing. First initialize it: import org.testng.asserts.Assertion; import org.testng.asserts.SoftAssert; public class MyTest { private SoftAssert softAssert = new SoftAssert(); } Then use it in your test: @Test(dataProvider = "getMailUrl") public void ...


2

The prerequisites for starting the object mapping mode are: project is created and opened a connection has been made to the AUT Agent (if this is successful, the "Stop AUT Agent" button on the toolbar will be enabled) an AUT has been configured via the project properties the AUT has been started. Your AUT is successfully started if the AUT can be seen to ...


2

Selenium 2 (webdriver) is designed to do exactly what you need. It allows you to simulate whatever real users can do with a browser: log to a website, click on buttons, fetch content of HTML elements, and analyze the text using any tools necessary. You can use different kinds of locators to identify HTML elements to process (ID, name, CSS class, link text ...


2

You can use Selenium Webdriver to automate this task. It can read the DOM of the HTML, and extract information from it; it controls a browser the same way you do, so anything you can do manually it can do (with a few exceptions). I would suggest looking into that rather than taking screenshots and parsing them as PDFs.


2

The answer was buried in some MSDN documentation that was challenging to google-reach: http://blogs.msdn.com/b/visualstudioalm/archive/2013/09/16/using-internet-explorer-11-and-not-able-to-record-a-web-performance-test-successfully.aspx Also ... don't forget to enable the test tool. Might have to check a couple places.


2

You can create extension methods for directly asserting elements. There you can wrap the assert statements with a try catch. In the catch, you can add the exception message to a log if you have one. public static class SafeAssertExtensions { public static void AreEquals(this IWebElement element, string expectedText) { try { ...


2

Your screenshot function is creating a new WebDriver instance each time and then taking a screenshot of the default blank page in firefox. You could try passing in your test's WebDriver instance so you get a picture from your test: static public void screenShotOnError(WebDriver driver) { long epoch = System.currentTimeMillis(); String ssTimestamp = ...


1

Most likely, Selenium is not in your class path, which appears to be exactly /Users/username/Desktop/workFiles/maven/MavenProject/target/MavenProject-1.0-SNAPSHOT.jar. It is surprising that you refer to this as a Maven project, and yet you choose to build it with Ant. Maven is also a build tool, and I believe IntelliJ can build using Maven if you ...


1

Failed assertion is nothing more than AssertionError which is a subclass of Throwable so you can treat it as any other exception. Example code: try { //some assertion } catch (AssertionError err) { //print error to the log //take screenshot //do whatever you want //do nothing } Usually it is being followed by finally block where the ...


1

Well, I solved it, but it might not be best practice. Basically, in each test method I assign that method to a current thread variable. targetThread = Thread.CurrentThread; and then, when the user presses the stop test button, i kill the thread. works like a charm. public void haltScript() { targetThread.Abort(); } of course, i'm ...


1

In order to run Webdriver commands on a remote machine, Selenium Server must be installed on that machine. What I usually do to enable IE and Chrome support is place the IE and Chrome drivers right alongside Selenium Server. I can then create a batch script with the complete command, something like: java -jar selenium-server-standalone-2.44.0.jar ...


1

I like Telerik Test Studio for web applications. It doesn't require any knowledge of programming and has an intuitive interface. The test runner can be put on any of the VMs you might be using. If it is not a web application, the only thing I have worked with would be AutoIT (which can have a steep learning curve).


1

Selenium IDE has a Rollup feature: Rollup – This option allows user to combine multiple test steps to act like a single command. Try to combine the click and the screenshot into a rollup with parameters. Some links: Rollup login example with paramaters: http://sanjitmohanty.com/2012/07/06/using-the-rollup-feature-of-selenium/ How to use rollup ...


1

Fixed the issue by removing '/' before the 'src'


1

From your question I'm assuming that you want to run your automation tests built using java one after the other using a batch file. Yes, you can run the tests using a batch file. Open a notepad and add your tests (binaries) like below and save is as YourTestFilename.bat echo off % java C:/Test/Test1 % java C:/Test/Test2 % java C:/Test/Test3 Or % java ...


1

You mention in the comments: What happens in my application is, after POSTing something, it takes sometime to update everything(indexing involved), for that specific reason we need to wait sometime and refresh the page, otherwise if I use wait for condition/wait until element is visible/wait until page contains/wait until page contains element , I cannot ...


1

I'm not sure what testing library (if any) you are using to execute the tests; I'm going to assume jUnit here, because that's what most people use for testing in Java. Similarly, I'm not sure if you're using ant or maven with this project. Using JUnit You can invoke the JUnit test runner from the command line using the following: java -cp ...


1

If you want all elements that match your selector, use findElements. This will return a list which you can iterate through. List rows = wd.findElements(By.className("vfmThumbnail"));


1

Their is more cloud site present for testing in mobile devices. (https://crossbrowsertesting.com/, https://www.browserstack.com/) N.T-- They are all commercial Enterprise service. You can try a demo for these cloud services in some limited devices or some few minutes.


1

Here's a sketch of the solution in Java: List<WebElement> list = driver.findElements(By.xpath("//*[contains(text(),'" + text + "')]")); verifyThat(list.size(), both(greaterThanOrEqualTo(1).and(lessThanOrEqualTo(3))); where I use: standard WebDriver methods to get a list of matching nodes verifyThat that in contrast with assertThat is a soft ...


1

driver.findElement(By.cssSelector("div.container-fluid > h3")) The findElement returns a WebElement and not its text and thus you cannot compare them like that. WebElements have a function getText() to return the text of the object. The assert should look like this: assertEquals("Risk Assessment Form: Completed", ...


1

I'm doing GUI testing automation for native desktop applications and I use pywinauto Python library based on Win32 API. Code looks very pythonic and human readable. But there were some pitfalls: pywinauto supported 32-bit only and it's not frequently updated (latest major update was at 2006). I had to port it to 64-bit, but now it meets all our ...



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