Element id’s with “#” pound sign and “\” backslash on Graphene 2

Posted: March 15, 2013 in web

 

HTML code

<div id="#quote-form\:filter_panel"></div>

First Option selector (using css post fix ($))

@FindBy(css = “div[id$=’filter_panel’]”)
private WebElement we;

NOTE: the above will work because graphene is using CSS3. It will NOT work using By.cssSelector from selenium cause its using CSS2.
Second Option selector (using xpath)

@FindBy(xpath = “//*[@id=\”#quote-form\\:filter_panel\”]”)
private WebElement we;

or

String xpath = “//*[@id=\”#quote-form\\:filter_panel\”]”
WebElement we = root.findElement(By.xpath(xpath));

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s