Favourite Quote

Every artist was first an amateur. - Ralph Waldo Emerson The more difficulties one has to encounter, within and without, the more significant and the higher in inspiration his life will be. - Horace Bushnell

Wednesday, November 17, 2010

ProxyInjection Mode

1.How to set the browser to Proxy Injection Mode ?


2.How to avoid using waitForpageload() ,wait(),pause(),thread.sleep()?

Add selenium.setSpeed(Constants.DEFAULT_TIMEOUT); at the start of the script.

3.How to check for dynamic ids in the object string using xpath

for example if dynamic ids have the format text-12345
where 12345 is a dynamic number you could use the following

XPath: //input[starts-with(@id, 'text-')]

4.How to Capture selenium server side logs if you don't start the server through code ?

java -jar selenium-server.jar -log selenium.log

5.How to Capture Browserside logs?

java -jar selenium-server.jar -log browserSideLog

6.How to use contains function in xpath ?
"//a[contains(text(),'Add New')]"

If there are multiple Add New on page its better to nail down to the one we are looking to click with index subscript.

//a[contains(text(),'Posts')]/following::a[contains(text(),'Add New')][1]

So we are using xpath axis which is following & an index[1]

Axis are used to work with node sets automationwithselenium.blogspot.com-Google pagerank and Worth

How to Capture Network Traffic using Selenium

CapturingNetwork Traffic - It could be used to know details such as the browser information.

public class Epc extends SeleneseTestCase
public static SeleniumServer selServer;
public static DefaultSelenium selenium;
final String URL = "";
int port = Constants.PORT;
String browser = Constants.BROWSER;

public void setUp() throws Exception
if(selServer == null)
RemoteControlConfiguration rc = new RemoteControlConfiguration();
selServer = new SeleniumServer(rc);
}catch(Exception e)

public void testWebservices() throws Exception
selenium = new DefaultSelenium("localhost",Constants.PORT,Constants.BROWSER,URL);
String trafficOutput = selenium.captureNetworkTraffic("plain");
System.out.println("\nNetwork Traffic captured in plain format !!!!"+trafficOutput);
selenium.click("link=Search UPRN by Address Web Service");


public void tearDown()

} automationwithselenium.blogspot.com-Google pagerank and Worth