Tag Info

New answers tagged

0

Try following code to start server: APILauncher launcher = new APILauncher(true); launcher.Start();


0

I believe that answers to your questions and more are in the The WebDriver Sampler: Your Top 10 Questions Answered guide.


0

The answer to this depends on what level of coding do you wish to do? How complex will your test script be? To begin with you might want to learn basic/core java and then keep on improving with practice and seeking help from others to put together complex scripts to test complex software.


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.


0

You could use driver.findElement(By.xpath(".//*[@id='ctl04_Pane2_AttributeDefinitionCategoryTest']/td[2]/div/select")).sendKeys(Keys.RETURN); for an easy fix. However there are ways to select by the value. Select select = new Select(driver.findElement(By.xpath(".//*[@id='ctl04_Pane2_AttributeDefinitionCategoryTest']/td[2]/div/select"))); ...


0

use driver.switchto().activeelement() before sending the arrow keys.


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


0

I think the easiest way to do this would be to manipulate the javascript on the page to get the two strings you need. First go to that primary shopping page and have the browser click the quick view this will load and give you a way to select the text use document.querySelector('h1 > a').textContent; and you should get something like "Roadster Men White ...


-1

It is giving you the web element just put .getText() whenever you see such code.


0

Something like this might help: public static Object scrollElementIntoView(WebDriver driver, WebElement element) { return ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", element); } Where element is the object to which we want to scroll to.


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


0

I needed to do this in javascript with protractor: browser.actions() .mouseMove( element(by.css('.material-dialog-container')) , -20, -20 // pixel offset from top left ) .click() .perform();


1

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


0

The image processing based Sikuli works on optical recognition of screen elements rather than HTML elements and can be a method to get around those peskily changing IDs.


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


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

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


0

I've been using the following as a constant: FF_PROFILE_PATH = os.path.join(os.environ['APPDATA'], 'Mozilla', 'Firefox', 'Profiles') I believe it's consistent across OSes per Mozilla support documentation. To locate the correct profile, you can iterate through the list created by os.listdir to find the profile, as such: ...


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


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


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


0

Learn the basics of JAVA(any programming language) - Door step to Selenium2 automation Assuming you have a basic understanding of HTML, CSS Learn about locators, simple selenium commands and try to automate simple functionality Once you got to know how to control the browser, you can go on using the frameworks like TestNG(preferrable) or JUnit Learn ...


0

WebDriver driver; //instantiated somewhere else, obviously WebElement element = driver.findElement(By.xpath("//div[@class='btnContr']/input[@value='Cancel']"); element.click(); Why are you bothering with JavascriptExecutor, when Selenium has the functionality to click an element selected by XPath built in?


0

You can link up your WebDriver tests to use PhantomJSDriver and catch those pesky JavaScript errors that might cause a manual test to fail, as well.


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



Top 50 recent answers are included