Skip to main content

Posts

Showing posts from March, 2014

Handle AJAX elements in Selenium 2 (WebDriver)

One approach is to use FluentWait and a Predicate available with Selenium2. The advantage of this approach is that element polling mechanism is configurable. The code example below waits for 1 second and polls for a textarea every 100 milliseconds. FluentWait<By> fluentWait = new FluentWait<By>(By.tagName("TEXTAREA")); fluentWait.pollingEvery(100, TimeUnit.MILLISECONDS); fluentWait.withTimeout(1000, TimeUnit.MILLISECONDS); fluentWait.until(new Predicate<By>() { public boolean apply(By by) { try { return browser.findElement(by).isDisplayed(); } catch (NoSuchElementException ex) { return false; } } }); browser.findElement(By.tagName("TEXTAREA")).sendKeys("text to enter");       Another approach is to use ExpectedCondition and WebDriverWait strategy. The code below waits for 20 s

RFT: Example for ITestDataTable, It helps how to access web table using RFT

import resources.parse_table_idHelper; import com.rational.test.ft.*; import com.rational.test.ft.object.interfaces.*; import com.rational.test.ft.object.interfaces.SAP.*; import com.rational.test.ft.object.interfaces.siebel.*; import com.rational.test.ft.script.*; import com.rational.test.ft.value.*; import com.rational.test.ft.vp.*; public class parse_table_id extends parse_table_idHelper { public void testMain(Object[] args) { try { //Search for html table TestObject[] foundTables = RationalTestScript.find( atDescendant(".class", "Html.TABLE", ".id", "my_table")); if (foundTables.length != 1) throw new Exception("Table not found"); StatelessGuiSubitemTestObject html_table = (StatelessGuiSubitemTestObject)foundTables[0]; // table parsing ITestDataTable table = (ITestDataTable)html_table.getTestData("contents"); int nbRows = table.getRowCount(); int nbCols = table.getColumnCount(); for (int i=0; i

How to install Gride 2.0 ?

In this section, you will use 2 machines. The first machine will be the system that will run the hub, while the other machine will run a node. For simplicity, let us call the machine where the hub runs as “Machine A” while the machine where the node runs will be “Machine B”. It is also important to note their IP addresses. Let us say that Machine A has an IP address of 192.168.1.3 while Machine B has an IP of 192.168.1.4. Step 1 Download the Selenium Server by   here .   Step 2 You can place the Selenium Server .jar file anywhere in your HardDrive.But for the purpose of this tutorial, place it on the C drive of both Machine A and Machine B. After doing this, you are now done installing Selenium Grid. The following steps will launch the hub and the node. Step 3 ·          * We are now going to launch a hub. Go to Machine A. Using the command prompt, navigate to the root of Machine A’s - C drive ,because that is the directory where we placed the Selenium Server.