Tag Info

Hot answers tagged

6

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


4

Try this line of code: Driver.findElement(By.xpath("enter your xpath")).click(); Hope it works out!


4

You can use the findElements method to find all TD tags that match your criteria, and then getText method to retrieve each element's value. The latter will be returned as a String, so you may need to convert it to a number before comparing it. Since the sorted elements have a special class, you may want to use a CSS selector with findElements.


4

You mean to say in one class multiple methods you want to run, then use below code and try. @BeforeTest public static void beforeMethod() { driver= new FirefoxDriver(); } @Test public void main1() { driver.get("http://indianrail.gov.in/pnr_Enq.html"); driver.findElement(By.id("element")).sendKeys("1234567890"); String ...


4

Although i do not have much idea about it but i think you can give selenium grid a try. I read on seleniumhq.org that with selenium grid you can create a master slave architecture, where one master machine will control several slaves to send request to a common server. Maybe this can help solve your issue!


3

You can use WebDriverWait to synch with page load. Something like the following might help WebDriverWait wait = new WebDriverWait(driver, 15); //you can play with the time integer to wait for longer than 15 seconds.` wait.until(ExpectedConditions.titleContains("title")); //if you want to wait for a particular title to show up OR ...


3

Try this Driver.SwitchTo().frame("Fancybox-frame"); Driver.findElement("enter your xpath to close popup").click(); Driver.SwitchTo().defaultContent();


3

No, Selenium 2 / WebDriver is for web applications only. But there are other tools to automate desktop application GUI tests. http://en.wikipedia.org/wiki/List_of_GUI_testing_tools You can also search for "desktop application" on this site to find recommended tools.


3

The actual slider is a link-element you should be able to define a css selector based on its classes. <a class="ui-slider-handle ui-state-default ui-corner-all" href="#"></a> The first you find is the left slider, the second the right slider. I have successfully used use the Action Builder and the MoveToOffsetAction to drag a slider X number ...


3

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


2

I have written a blog on how to take screen shots while using webdriver APIs, This is a basic code but it will help you in taking screenshots. http://apttest.in/how-to-capture-screenshot-in-webdriver-using-java/ package screenshot_package; import java.io.File; import org.apache.commons.io.FileUtils; import org.openqa.selenium.OutputType; import ...


2

1.In eclipse i have executed the tests they are working fine, how i have to execute them in production server? Your tests can run in every environment. You can have a Selenium Hub and many VMs with different operating systems and browsers. But for the beginning the tests can also run from your local computer. You can choose against what environment ...


2

Try using SIkuli it can automate anything , since it uses Image recognition http://www.sikuli.org/


2

Create a string variable and use it (for example) as follows: string strMyXPath = "//*[@id='" + recordId + "_ACTION_COLUMN']/a[2]/span"; driver.FindElement(By.XPath(strMyXPath)).Click();


2

Quickly glanced over the properties and methods of IWebElement, doesn't look like they can set values. However, you can easily execute some javascript snippet to change HTML in your page. IWebDriver driver; IJavaScriptExecutor js = driver as IJavaScriptExecutor; js.ExecuteScript("document.getElementById("title").innerHTML = "New text!";"); You might need ...


2

you can pass the driver as argument to the methods , so no need to re create them.


2

You can try setting implicit wait time. (Documentation) // 5 seconds implicit wait (C# code) IWebDriver driver = new FirefoxDriver(); driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));


2

This is how I would debug a Selenium session to find out what is happening: Step-by-step debugging: Most IDE's allow you todo step-by-step debugging, you could set a break point just before the point you want to investigate. This will pause the execution of the test and lets you examine the browser with its own tools. You can step thru each line of code one ...


2

Selenium has no built in support to execute a test case, or collection of test cases, or ability to execute a parameterized test case. Selenium is simply a framework to interact with a web UI. The test execution engine you use to actually kick off your selenium tests varies depending on which language you are using, and even for a specific language there ...


2

The tools you name are used during different steps in the SDLC, they can be replaced by other alternative tools Example (partial) development life cycle: Programming -> Check-in to version control -> Schedule build and run build -> Run automated test against build -> Report failing tests/builds Check-in to version control After developers are ...


2

It is quite easy to hide the browser without XVFB. Just install PhantomJS. Then, change this line: driver = webdriver.Firefox() to: driver = webdriver.PhantomJS() The rest of your code won't need to be changed and no browser will open. For debugging purposes, use driver.save_screenshot('screen.png') at different steps of your code.


2

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


2

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


2

As I know captcha (Some captcha you can test) you can not test using selenium webdriver.


2

Selenium is a tool to drive and verify behavior of web-applications, it should not matter where they are hosted. If you can reach the webserver running the application it can be local or hosted in the cloud, the application should behave the same. If you want to test if the cloud setup can handle a certain load and find its bottlenecks I would look at a ...


2

@Imen: I know below mentioned reporting techniques. And more important is how you want your reports (Line by line/step by step execution report, class/method level report, etc..?). What's the best appropriate method used by Selenium Testers to generate tests reports? Selenium will support multiple reports generation techniques. Testers will be using ...


1

I have experienced the same thing. I believe that for some reason it stops executing Java scripts on the page once the focus to the browser is lost. My quick workaround was to create a Linux VM on my Mac, and do all the testing (and development) in it, because then the browser is always in focus, even when you do other stuff in the host OS.


1

You could put a sleep after every instruction - or around the instructions you are interested in.


1

I used to use Fitnium when I was doing work with Fitnesse and WebDriver early on, I found it did not scale well for the types of tests I was doing but it may work for you. I was testing a Login and Registration system, the pages used a lot of JSON and I had issues getting the timing right so the pages would load with the right drop downs or complete the ...


1

WebDriver cannot be used todo browser specific actions, it can only be used to drive the web-page. Although sending the keys CTRL-TAB might switch tabs WebDriver will still think you are in the previous window. Switching Tabs as you want is thus actually something different. Each tab is actually a window organised in a tab like look-and-feel. Thus you ...



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