selenium - XPATH and CSS locators throws error for Chrome in webdriver -


i facing issues in locating element in chrome. xpath of element looks way:

//*[@id="signin"] (right click on element , copy xpath) 

css same:

$$("div[id='signin']") 

now able locate element in chrome when hover on them manually. when try implement same code throws error.

driver.findelement(by.cssselector("$$("div[id='signin']")).click(); - css driver.findelement(by.xpath("//*[@id="signin"]")).click(); - xpath 

it throws remove argument match 'xpath(string)' help!!

code :

public static webdriver driver;   @beforeclass public static void start() {     file file = new file("d:/new/chromedriver.exe");     system.setproperty("webdriver.chrome.driver", file.getabsolutepath());     driver = new chromedriver();     driver.get("http://abcd.com"); }   @afterclass public static void close() {     driver.close(); }   @test public static void test()      {     driver.findelement(by.name("userid")).sendkeys("100");     driver.findelement(by.name("password")).sendkeys("100");     driver.findelement(by.xpath("//*[@id='signin']")).click();       }  } 

@note : url here dummy. in real time using proper url. throws below error

failed: test org.openqa.selenium.nosuchelementexception: element not found (warning: server did not provide stacktrace information) command duration or timeout: 89 milliseconds documentation on error, please visit: http://seleniumhq.org/exceptions/no_such_element.html build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:23:22' system info: os.name: 'windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0'

try enclosing signin in single quotes instead of double quotes shown below.

driver.findelement(by.xpath("//*[@id='signin']")).click(); - xpath 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -