Selenium Java Webdriver: Adding a string to an Xpath -


i have folllowing piece of java in want add string inside statement:

     @and ("^i want change fieldnumber \"([^\"]*)\" , remove whats inside , add following text: \"([^\"]*)\"$")      public void testscenario12345(string number,  string text) throws throwable {     driver.findelement(by.xpath("//*[contains(@name,'template:view:<insert number string here>:item:view:1:item:')]")).clear();     driver.findelement(by.xpath("//*[contains(@name,'template:view:<insert number string here>:item:view:1:item:')]")).sendkeys(text); 

how can add number string in above piece of code? clarify, if insert "4" in cucumber, want driver find element xpath, @name contains template:view:4:item:view:1:item:

what

driver.findelement(by.xpath("//*[contains(@name,\"template:view:" + number+ ":item:view:1:item:\")]")).clear(); 

and need number const, means:

public void testscenario12345(final string number,  string text) throws throwable { 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -