Tag Info

Hot answers tagged

5

Java My experience is, that the basics of Java suffice to start developing test cases with Selenium 2 / WebDriver. Myself started developing of Selenium test cases with a basic knowledge about Java. The more test cases I wrote and solutions I had to find, the more I leaned about the programming language. Unit Testing Framework (JUnit, TestNG) Write some ...


3

Sadly, it sounds like using the ID is not an option in this scenario A lot of websites implement security to prevent automating. While this makes your job more difficult it does improve the security of the application. So what can be done to bypass these security tricks? Use a different unique constant for that element This could mean using the class, ...


2

Please Use select.selectByValue("Vodafone"); OR kindly post the HTML code and go through this Link Link As per your comments below updated the code: import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.Select; ...


2

You can't capture the id's every time, you need to find some other way of uniquely identifying the elements. I'm assuming this is a 3rd party tool that you don't have any control over, but if you do have control you could ask the developers to provide either a unique ID or some other unique identifier. Some other options you have would be to identify ...


1

I found this really simple code to write output to file. You can find it here - http://www.mkyong.com/java/how-to-write-to-file-in-java-bufferedwriter-example/ You can customize the code to fit your need and write the list values to file by placing the bw.write() part withing a loop.


1

Hello since you are getting the results in the List, you can export them to a file for use in future, or can use them further for comparison or whatever you need since the data is already stored in the List variable. You can see in this sample code here - http://milinpatel17.wordpress.com/2014/07/02/web-page-link-test-using-selenium-webdriver/ that I have ...


1

You want to use component query. From Webdriver you can execute arbitrary javascript - that means you can use ComponentQuery to get things from a high level and then drill down with (maybe) xpath to get more specific things. This article helped me figure it out. for example you'd probably use component query to get hold of a control and a button in that ...


1

You are comparing values, so better you store each values in the String and compare both the String values.


1

Use another identifier to identify the object or use xpath, for example: starts-with If your dynamic element's ids have the format where button id="continue-12345" where 12345 is a dynamic number you could use the following XPath: //button[starts-with(@id, 'continue-')] contains Sometimes an element gets identified by a value that could be surrounded ...


1

Please use below code. driver.get("http://www.flipkart.com/"); driver.manage().window().maximize(); driver.findElement(By.linkText("Trimmer")).click(); WebElement scroll = driver.findElement(By.id("brand")); scroll.sendKeys(Keys.PAGE_DOWN);


1

You can refer this link and let us know is this ok for you Link


1

you can use following code to switch between windows based on the window title. or please go through this link Link private void handleMultipleWindows(String windowTitle) { Set<String> windows = driver.getWindowHandles(); for (String window : windows) { driver.switchTo().window(window); if ...


1

What this does is, it waits until the element with id "foo" is found. If the element is not found, retry every 5 seconds. But wait only up to a maximum of 30 seconds. It does this by calling the following function every 5 seconds, until it doesn't return null: public WebElement apply(WebDriver driver) { return driver.findElement(By.id("foo")); } The ...


1

Personally I would put a wait and in the wait try to click and then verify the popup exists, catch the error and try to click and verify again. That way as soon as it's ready it will return and you aren't using a timer. That is good practice anyway to not just wait a specific time, but wait for a particular event to take place and then move on. c# ...



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