Hai i am trying to use webdriver in selenium test.but I can't find any element .always getting element not found exception.i tried,name,id,xpath everything..i am not using frames in my project, if we not using the frame or iframe cant we access elements inside div?in my case there are no frame tags.am giving example structure of my code.pls help
java code
WebDriver d = new ChromeDriver();
d.get("http://myurlOne");
WebElement username = d.findElement(By.id("username_id"));
username.sendKeys("123");
WebElement password = d.findElement(By.id("password_id"));
password.sendKeys("123");
d.findElement(By.id("loginButton")).click();
System.out.println("logged in successfully");
d.get("http://navigatedurl");
JavascriptExecutor js = (JavascriptExecutor)d;
System.out.println("navigated to new page");
WebDriverWait wait__mob = new WebDriverWait(d, 20);
try {
System.out.println("Start"+new Date());
WebDriverWait wait__mob = new WebDriverWait(d, 20);
try {
System.out.println("Start"+new Date());
wait__mob .pollingEvery(100,TimeUnit.MILLISECONDS).until(ExpectedConditions.visibilityOfElementLocated(By.id("mobileNo")));
d.findElement(By.id("mobileNo")).sendKeys("99999999999);
} catch (TimeoutException e) {
// TODO: handle exception
System.out.println(e.toString());
}
Html code
<html>
<body>
<form class="formVal">
<fieldset class="col-sm-9 col-md-12 leftpadding-none">
<div class="form-group">
<label class="col-xs-5 control-label"
for="inputconsumerName">Consumer Name</label>
<div class="col-xs-6 leftpadding-none">
<input type="inputconsumerName" class="form-control k-input"
id="inputconsumerName" placeholder="" >
</div>
<div class="col-xs-1 leftpadding-none"> <a href=".loyalty" data-
toggle="tab" class="add-consumer"><span class="glyphicon
glyphicon-plus"></span></a> </div>
</div>
<div class="form-group">
<label class="col-xs-5 control-label" for="inputmobileNo">Mobile
No.</label>
<div class="col-xs-6 leftpadding-none">
<input type="inputmobileNo" class="form-control k-input"
id="mobileNo" placeholder="" >
</div>
</div>
<div class="form-group bottommargin-none">
<label class="col-xs-5 control-label" for="inputOtherNo">OtherNo.
</label>
<div class="col-xs-6 leftpadding-none">
<input type="otherNo" class="form-control k-input"
id="otherNo" placeholder="">
</div>
</div>
</fieldset>
</form>
</body>
</html>