Share
Go down
Sel_Tester
Posts : 3
Join date : 2011-09-07

unable to fetch the text in the page using gettext command

on Wed Sep 07, 2011 10:51 am
Hi All,

Thanks for reading my query.
i need some help.
I have a page here which has a header named " System Information" and
then a table.

I have written a piece of code like this :
---------------------------------------------------------------------------­---------------------------------------------------------------------------­----------
public class e
{
static Selenium browser ;
public static void main(String[] args){
browser = new DefaultSelenium("localhost", 4444, "*firefox C:\
\program Files\\Mozilla Firefox\\firefox.exe", "Web_url");
browser.start();
browser.open("web_url");
browser.selectFrame("GB_frame");
browser.type("name=username", "admin");
browser.type("name=password", "admin");
browser.click("name=Submit");
String PageHeader = browser.getText("/html/body/div[@id='shell']/
div[@id='wrapper']/div[@id='outer']/div[@id='center']/
div[@id='containerCenter']/div[1]/div/h1");
System.out.println(PageHeader); }
---------------------------------------------------------------------------­---------------------------------------------------------------------------­-----------
The Xpather shows this : /html/body/div[@id='shell']/
div[@id='wrapper']/div[@id='outer']/div[@id='center']/
div[@id='containerCenter']/div[1]/div/h1
XPath returns these :
- id('containerCenter')/div[1]/div/h1
- //div[@id='containerCenter']/div[1]/div/h1
- /h1.

Using IDE , Verify text works fine.
but using the UI map or once i have the path from XPather / Xpath , it
says command not found or unable to locate the element.

Pleaseee Help.
Regards,
Steve

Back to top
Permissions in this forum:
You cannot reply to topics in this forum