Tag Info

New answers tagged

0

You need to troubleshoot / evaluate below options Is your test machine having low configuration or in a different network ? If you run tests on machine which has Application installed is it faster ? Can you batch it and run tests ? instead of running it altogether ? Can you distribute the cases. Compile the the project as a jar. Deploy it in multiple ...


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

The interesting part of Selenium (the part that controls the browser) -- is a Javascript library that runs in the browser. The multi-language API is a set of libraries that talk to that Javascript library. Each API has the same browser control primitives. There are other libraries that might make working with Selenium more convenient, e.g. support for ...


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


0

By IDE you can't check the code (scripts), but you can check the results of running code (scripts) - the HTML tags or their changes. More variability to Selenium IDE you can add with Selblocks plugin, which allows you to make conditions and jumps.


0

If you use Selenium IDE to make tests and export to C# you will find that not all commands are availible. So you dont gain any features but you might lose some in the translation process. Essentially, a thrid party plugin converts from Seleniese to whatever language. Use whatever language you feel comfortable using.


0

IMHO the node config file is not formatted correctly (should be a valid JSON file). the "version":"6.1" the value should be string, and the “hubHost”: “192.168.28.74”: <--- shouldn't contain colon after the host hub address. And IMO you should define: "hub": "http://<address>:<port>/grid/register", too on the configuration area. here is ...


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(); ...


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


0

Please check below reference links :--------- http://seleniumeasy.com/selenium-tutorials/xpath-tutorial-for-selenium http://seleniummaster.com/sitecontent/index.php/introduction-to-selenium-automation/selenium-ide/115-selenium-ide-xpath-tutorials


0

On writing xpaths: a great reference website if you like reading documentation. On validating xpaths: You need to run the tests and validate they're clicking on and finding the correct elements. If there's a syntax issue with your locator, the test will fail since whatever XML parser Selenium uses in your language will throw an exception if you have a ...


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.


0

as far as i got the same Error i have done setting in Internet Explorer tools -> internet option -> security make security from high to medium-high or medium and UN-check Enablae Protection Mode second problem i found is Sendkeys Working too Slow For this problem i used IE 32 Bit Driver Hope this will solve your Problem.


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


0

I prefer Sikuli for quick tests of a specific functionality/defect, and then Selenium for regression/catch-all E2E tests. Some examples of my usage Selenium: The functionality of questionnaire. Checks for UI text based on ids, and then runs through all permutations of the questionnaire to check that all behavior and page redirects are as expected. Run ...


0

I hope that I am understanding your question fully, I am going to attempt to answer it the best that I can. If you give selenium a location of the element, it should be able to click it; no matter how far scrolled down the page it is. Give the location of your button to selenium and it should click it wherever it is, however many times you need it to click ...


0

The problem could be that the page in the new window is still loading while you are trying to interact with it, so you might need to add in a wait condition. When I've done this, I've added in waits to make sure that the new window has actually been opened, and then to make sure the page in the new window is loaded. from selenium.webdriver.support.wait ...


0

Sikuli is useful when there is no easy access to a GUI's internal or source code. Selenium or Watir identifies web elements by ID, Name, XPath etc. on the contrary Sikuli finds the elements by image/screenshot which is easier.


0

Can you try this and see if you still get the same error? Also rebuild your entire project to be sure. File pathToBinary = new File("C:\FirefoxPortable\FirefoxPortable.exe"); FirefoxBinary ffBinary = new FirefoxBinary(pathToBinary);


0

It is hard to say without seeing your code but a quick search on StackOverflow shows that people with similar error messages are having issues related to IE's Protected Mode (source) or: capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true); (source).


0

You can't interact with the native OS file browser dialog directly, but we do some magic so that if you call WebElement#sendKeys("/path/to/file") on a file upload element, it does the right thing. Make sure you don't WebElement#click() the file upload element, or the browser will probably hang. Source - Selenium WebDriver Wiki. Protractor uses ...


1

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


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


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


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

WebDriver driver; driver.quit(); Above will close all open browser windwos. And WebDriver driver; driver.close(); This will close current browser window in focus.


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

I do this test as little different way.I am using exception of wait.You can also use more time for wait object. public static boolean isClickable(WebElement webe) { try { WebDriverWait wait = new WebDriverWait(yourWebDriver, 5); wait.until(ExpectedConditions.elementToBeClickable(webe)); return true; } catch (Exception e) { return false; } ...


-1

First Solution : By default you cannot find the element is click able or not you must have to perform click action on that element and after clicking on the element check any unique locator after click event perform. Second Solution : check the element tag name String tagname=driver.findElement(By.id("id")).getTagName(); if it is button then check it's ...


-1

You have to check whether the element has "disabled" attribute. Read more on that here: HTML disabled Attribute Textarea disabled Property HTML disabled Attribute


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


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


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


0

Hello @rOCkINGsp007 , when ever your finding elements with tag tr , then just check whether the element is visible or not. If element is visible/displayed then add it an array and at last you can find the total number of elements were displayed in a page from array


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


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


0

Please use driver.close() and driver.quit() both in the end. driver.close – It closes the the browser window on which the focus is set. driver.quit – It basically calls driver.dispose method which in turn closes all the browser windows and ends the WebDriver session gracefully.


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

1) driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); This means that we can tell Selenium that we would like it to wait for a certain amount of time before throwing an exception that it cannot find the element on the page. We should note that implicit waits will be in place for the entire time the browser is open. This means that any search ...


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


0

Try and convert this to the Python equivalent. Check this link: For Firefox: FirefoxProfile profile = new FirefoxProfile(); profile.setPreference( "intl.accept_languages", "es" ); WebDriver driver = new FirefoxDriver(profile); For Chrome: ChromeOptions options = new ChromeOptions(); options.AddArguments("--lang=es"); ChromeDriver driver = new ...



Top 50 recent answers are included