Tag Info

New answers tagged

0

How the spreadsheet/workbook is created shouldn't matter. You may have some issues with cells whose value is derived from a formula though. I like to work with .csv files if at all possible. They are much easier to parse if you write the java code yourself (without using 3rd party libraries). Here are a few examples for Excel file types, from ...


0

Check if: element is visible in your viewport, if not, try calling maximize_window() in order to maximize the current window that webdriver is using, your element is not appearing twice (under the same selector), and you're selecting the wrong one, if your element is hidden, then consider making it visible, if you'd like to change value of hidden element, ...


0

File file = new File("G:\\Selenium\\All_Jars\\chromedriver.exe"); System.setProperty("webdriver.chrome.driver",file.getAbsolutePath() ); driver = new ChromeDriver(); //Maximize the window driver.manage().window().maximize(); driver.get("http://www.rediff.com/"); //Get all window handles Set<String> allHandles = driver.getWindowHandles(); ...


0

Did you run PageFactory.initElements? The PageFactory magic won't actually parse the annotations until you do so. I usually put into the constructor a line like: PageFactory.initElements(driver, this); So that it runs when I construct the page.


1

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


0

Here is the error you are getting: java.lang.IllegalArgumentException: Not a file or directory: /src/test/java/com/project/cucumber/cucumber Notice the file path: /src/test/java/com/project/cucumber/cucumber In your project directory, you list out the directories as follows: /src/test/java/com/project/cucumber/ Therefore, there's one too many ...


0

I would suggest just exporting a jar file for your project. All the libraries will be packaged together in the jar files(including TestNG) and you can simply double click on the jar file to start your tests. Make a runner file that calls all the tests you have to run one by one. External resources (if any), will have to be available for the jar file though. ...


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

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 ...


0

NPE exception comes while some situations are there.Please first avoid this situations. 1) Your browser should be open in screen. You can not minimize while taking screenshot. It is limitation of that. Screenshot captures opened/window display only. 2) Remove turn off display option from sleep mode. While you turn off display you get surely NPE. Because ...


0

It's only difficult until you learn how to program. :) If you're already using Java and Selenium then you know how to program. You will have to learn how the code you're testing works and you will need to learn how to write unit tests. tl;dr you can do it.


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 ...


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 { ...


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 ...


0

As a manual tester you likely don't have the foundation skills yet in place to be a performance tester, independent of tool. Look to the automated functional testing tool path. Here you will need to leverage your refined functional testing skills along with development skills to answer questions related to functional quality. If you want to add an extra ...


0

I think you required Image validations. The best way is to compare your screenshot. See https://www.linkedin.com/grp/post/2102114-230457057 http://stackoverflow.com/questions/21179019/how-to-compare-set-of-images-in-java-using-pixel-based-image-comparision-metric Otherwise you have to check it by yourself. Note : You can check if element is not loaded in ...


0

Actually 'throws exceptions' is the only way to get error. If error comes from your setup or dependency it will not shown If you remove throws statement. If you are not confident about which exception is coming then write 'throws Exception'. It will throw all exception by default. Now come to your question. Your code perfectly fine working. Just check ...


3

This error means that you have forgotten to include a dependency in your project. It's been suggested on stackoverflow that the dependency you forgot might well be selenium-server-standalone-version.jar. Does adding that jar to your project help?


1

Webdriver doesn't have eyes; therefore, there's a hard limit to the amount of GUI validation it can do. It can't tell you if the image that was served looks correct, or if it is broken. What it can tell you is that that image file was included in the HTML for the page. You'd need a human to verify that the page looks correct visually.


1

Implicit Wait: An implicit wait is to tell WebDriver to poll the DOM for a certain amount of time when trying to find an element or elements if they are not immediately available. The default setting is 0. Once set, the implicit wait is set for the life of the WebDriver object instance. WebDriver driver = new FirefoxDriver(); ...


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

You would do this the same way you do any other conditional in Java: if (!SSN.isEmpty()) { //Assuming SSN is a string variable driver.findElement(By.xpath("ADD")).click(); actions.sendkeys(SSN).perform(); } This is a basic programming question; as such, I would suggest picking up a book or an online course about Java programming, as it will help ...



Top 50 recent answers are included