Tag Info

Hot answers tagged

4

I've tested using format http://user:pass@host and it works. So in Python (in setUp() of MyClass(unittest.TestCase) class) this should look like: self.base_url = "http://user:pass@host" In Java based on #34 at code.google, the following code should work as well: public void login(String username, String password){ WebDriver driver = getDriver(); ...


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


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

Normally both your home and the company networks are fire-walled, letting no external traffic in. There are two possible solutions: Poke holes in the company firewall for Selenium traffic back and forth Create a VPN-tunnel between both Poking holes Make sure the firewall and routers forward any traffic on port 4444 to the company internal Selenium hub ...


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

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?


3

you have to install firebug + firepath in mozilla firefox it will also provide you generated xpath You can also write the created xpath in the text field and press enter and it will validate the xpath .//*[contains(@placeholder,'Enter your email')] for creating xpath and locator search on google about locator strategies in selenium


2

Setting up Selenium tests to run on Safari browser is a fairly complex process. You need to install Safari Extensions Developer Certificate in your machine and also install selenium webdriver as an extension in Safari Browser. Also there are some stability issues with Safari browser automation & Selenium combination on Mac 10.9 OS and below. The ...


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


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


1

I really like the answer from the link Philip Beadle posted in a comment: It's a bad idea to test the core browser's behaviour as it's not your logic, i.e. you should not need to test that arrow keys work with options since that's something your browser implements. And some Protractor (JavaScript) examples how to handle the drop from the same ...


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

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

Apache JMeter is designed for load testing and it provides Selenium support via WebDriver Sampler The WebDriver Sampler uses JavaScript language for tests definition so minimal refactoring will be required and your tests should mostly work. See The WebDriver Sampler: Your Top 10 Questions Answered guide for tips and tricks. Alternative options are using ...


1

So selenium was created in java, so they have all of the advantages of updates and community for questions. I personally like C# because of my background with the .NET technologies. I know that people have recommended that I switch to java because of the community base, and how quickly things are updated for their technology. So to answer your question, none ...


1

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


1

Check this code. It works properly in IE. All you need to set some capabilities. DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer(); ieCapabilities.setCapability("nativeEvents", false); ieCapabilities.setCapability("unexpectedAlertBehaviour", "accept"); ieCapabilities.setCapability("ignoreProtectedModeSettings", true); ...


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


1

(You did not say how many simultaneous users you need to simulate for your stress test. My answer assumes you need to simulate more than 5 or 10.) Using your Selenium tests as the basis for stress testing is an attractive idea. After all, they are already written/debugged. You would like to check the same things under load, so they seem relevant. And ...


1

Instead of using getTitle(), try the below: WebElement title = driver.findElement(By.tagName("title")); System.out.println(title.getText());


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

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



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