I am new to selenium and trying to find the correct xpath or CSS for the html code below and after spending so much time and after numerous trials I was not able to click on these elements and I need some help here. There seems to something very basic that I am missing here.I am getting NoSuchElementException.
The 1st HTML:
<input class="form-control" id="name" name="name" value="" type="text">
I tried following code:
driver.findElement(By.xpath("//*[@id="name"]")).sendKeys("Something");
driver.findElement(By.id("name")).sendKeys("Something");
driver.findElement(By.cssSelector("input[value='']")).sendKeys("Something");
The 2nd HTML:
<a href="#fragment2" data-toggle="tab" aria-expanded="true">
<span>Module Permissions</span>
</a>
I tried following code:
driver.findElement(By.xpath("//span[contains(text(), 'Module Permissions')]")).click();
driver.findElement(By.linkText("Module Permissions")).click();
My Test Env:
- Google Chrome Version 66.0.3359.181
- Selenium WebDriver Version: 3.12
Any help is much appreciated.