How can I Selecting Kendo Drop Down using xpath - selenium

I have the following HTML:
<table class="w98">
<tbody>
<tr>
<tr>
<tr>
<td class="p-controlSetLabel">
<td class="editor-field">
**<span class="k-widget k-dropdown k-header" style="width: 165px;" title="" unselectable="on" role="listbox" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-owns="VatRateId_listbox" aria-disabled="false" aria-readonly="false" aria-busy="false" aria-activedescendant="304dd433-4a68-458b-a6d6-03b72335f1cb">**
<span class="k-dropdown-wrap k-state-default" unselectable="on">
<span class="k-input" unselectable="on">Standard - Standard</span>
<span class="k-select" unselectable="on">
<span class="k-icon k-i-arrow-s" unselectable="on">select</span>
</span>
</span>
<input id="VatRateId" class="k-valid" type="text" value="d20b" style="width: 165px; display: none;" name="VatRateId" data-val-required="Please select a VAT Rate." data-val="true" data-role="dropdownlist">
The input id="VatRateId" is hidden, so I can't access it.
My current solution is the following:
var allDropDownFields = FindElements(By.XPath(".//*[#class='k-dropdown-wrap k-state-default']") -- This will return a list of all drop down fields
Then I loop each one of them to find the correct drop down field I want.
Is there a better way of finding the element without getting a list, I tried the following:
FindElement(By.XPath(".//*[#class='k-dropdown-wrap k-state-default'and #aria-owns = 'VatRateId_listbox']")
and the above code is not work.
HTML code is as below:-
<span class="k-widget k-dropdown k-header" style="width: 165px;" title="" unselectable="on" role="listbox" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-owns="VatRateId_listbox" aria-disabled="false" aria-readonly="false" aria-busy="false" aria-activedescendant="304dd433-4a68-458b-a6d6-03b72335f1cb">* <span class="k-dropdown-wrap k-state-default" unselectable="on"> <span class="k-input" unselectable="on">Standard - Standard</span>
Any better suggestion?

Related

Selenium WebDriver could not locate CKEditor iFrame and enter text

Here is html code. I used iFrame class to identify and but unable to locate
<textarea class="form-control qlib-ck-editor" cols="20" id="QuestionText" name="QuestionText" onload="initializeCkInstance('QuestionText');" rows="7" style="visibility: hidden; display: none;"></textarea>
<div id="cke_QuestionText" class="cke_1 cke cke_reset cke_chrome cke_editor_QuestionText cke_ltr cke_browser_webkit" dir="ltr" lang="en" role="application" aria-labelledby="cke_QuestionText_arialbl"><span id="cke_QuestionText_arialbl" class="cke_voice_label">Rich Text Editor, QuestionText</span>
<div class="cke_inner cke_reset" role="presentation"><span id="cke_1_top" class="cke_top cke_reset_all" role="presentation" style="height: auto; user-select: none;">
<span id="cke_14" class="cke_voice_label">Editor toolbars</span>
<span id="cke_1_toolbox" class="cke_toolbox" role="group" aria-labelledby="cke_14" onmousedown="return false;">
<span id="cke_15" class="cke_toolbar cke_toolbar_last" aria-labelledby="cke_15_label" role="toolbar">
<span id="cke_15_label" class="cke_voice_label">Basic Styles</span>
<span class="cke_toolbar_start"></span><span class="cke_toolgroup" role="presentation">
<a id="cke_16" class="cke_button cke_button__bold cke_button_off" href="javascript:void('Bold')" title="Bold (Ctrl+B)" tabindex="-1" hidefocus="true" role="button" aria-labelledby="cke_16_label" aria-describedby="cke_16_description" aria-haspopup="false" onkeydown="return CKEDITOR.tools.callFunction(1,event);" onfocus="return CKEDITOR.tools.callFunction(2,event);" onclick="CKEDITOR.tools.callFunction(3,this);return false;">
<span class="cke_button_icon cke_button__bold_icon" style="background-image:url('https://qlib-qa.azurewebsites.net/Scripts/ckeditor/plugins/icons.png?t=I3I8');background-position:0 0px;background-size:auto;"> </span>
<span id="cke_16_label" class="cke_button_label cke_button__bold_label" aria-hidden="false">Bold</span>
<span id="cke_16_description" class="cke_button_label" aria-hidden="false">Keyboard shortcut Ctrl+B</span>
</a>
<a id="cke_17" class="cke_button cke_button__italic cke_button_off" href="javascript:void('Italic')" title="Italic (Ctrl+I)" tabindex="-1" hidefocus="true" role="button" aria-labelledby="cke_17_label" aria-describedby="cke_17_description" aria-haspopup="false" onkeydown="return CKEDITOR.tools.callFunction(4,event);" onfocus="return CKEDITOR.tools.callFunction(5,event);" onclick="CKEDITOR.tools.callFunction(6,this);return false;">
<span class="cke_button_icon cke_button__italic_icon" style="background-image:url('https://qlib-qa.azurewebsites.net/Scripts/ckeditor/plugins/icons.png?t=I3I8');background-position:0 -24px;background-size:auto;"> </span>
<span id="cke_17_label" class="cke_button_label cke_button__italic_label" aria-hidden="false">Italic</span><span id="cke_17_description" class="cke_button_label" aria-hidden="false">Keyboard shortcut Ctrl+I</span>
</a>
<a id="cke_18" class="cke_button cke_button__underline cke_button_off" href="javascript:void('Underline')" title="Underline (Ctrl+U)" tabindex="-1" hidefocus="true" role="button" aria-labelledby="cke_18_label" aria-describedby="cke_18_description" aria-haspopup="false" onkeydown="return CKEDITOR.tools.callFunction(7,event);" onfocus="return CKEDITOR.tools.callFunction(8,event);" onclick="CKEDITOR.tools.callFunction(9,this);return false;">
<span class="cke_button_icon cke_button__underline_icon" style="background-image:url('https://qlib-qa.azurewebsites.net/Scripts/ckeditor/plugins/icons.png?t=I3I8');background-position:0 -120px;background-size:auto;"> </span>
<span id="cke_18_label" class="cke_button_label cke_button__underline_label" aria-hidden="false">Underline</span>
<span id="cke_18_description" class="cke_button_label" aria-hidden="false">Keyboard shortcut Ctrl+U</span></a>
</span><span class="cke_toolbar_end"></span></span>
</span>
</span>
<div id="cke_1_contents" class="cke_contents cke_reset" role="presentation" style="height: 200px;">
<span id="cke_22" class="cke_voice_label">Press ALT 0 for help</span>
<iframe src="" frameborder="0" class="cke_wysiwyg_frame cke_reset" style="width: 100%; height: 100%;" title="Rich Text Editor, QuestionText" aria-describedby="cke_22" tabindex="0" allowtransparency="true"></iframe>
</div>
<span id="cke_1_bottom" class="cke_bottom cke_reset_all" role="presentation" style="user-select: none;">
<span id="cke_1_resizer" class="cke_resizer cke_resizer_vertical cke_resizer_ltr" title="Resize" onmousedown="CKEDITOR.tools.callFunction(0, event)">◢</span>
<div class="cke_wordcount" style="" title="Statistics">
<span id="cke_wordcount_QuestionText" class="cke_path_item">Characters: 0</span>
</div>
</span>
</div>
</div>

Not able to check the check box, exception "element not visible"

In an table which can contain more rows, user is searchable using the email id. After searching, selecting the first check box. But selenium is throwing the element not visible exception.
//*[#id='share_user']/tbody/tr1/td1//label
//*[#id='share_user']/tbody/tr1/td1//input
//label[#for='checkbox_416']
last identifier is dynamic. Still getting the element not visible exception.
Table code is mentioned below
<table class="table table-striped table-hover dataTable" id="share_user"
aria-describedby="share_user_info">
<thead>
<tr role="row">
<th class="small-cell sorting" role="columnheader" tabindex="0"
aria-controls="share_user" rowspan="1" colspan="1" style="width: 137px;"
aria-label="Share Profile : activate to sort column ascending">Share Profile </th>
<th class="medium-cell sorting" role="columnheader" tabindex="0"
aria-controls="share_user" rowspan="1" colspan="1" style="width: 523px;"
aria-label="User Details: activate to sort column ascending">User Details</th>
<th class="medium-cell sorting_asc" role="columnheader" tabindex="0"
aria-controls="share_user" rowspan="1" colspan="1" style="width: 366px;"
aria-sort="ascending" aria-label="Access: activate to sort column descending">Access</th>
</tr>
</thead>
<tbody role="alert" aria-live="polite" aria-relevant="all">
<tr class="odd">
<td class="">
<div class="checkbox check-default">
<input name="checkUser" id="checkbox_416" value="416" class="shareCheck"
type="checkbox">
<label for="checkbox_416"></label>
</div>
</td>
<td class=" ">
<img src="" class="img-responsive display-inline share-image">
<div class="display-inline">
<p class="share-name">alexx</p>
<p class="muted">
<i class="fa fa-envelope" hidden="true"></i>
<span>alexxm360#gmail.com</span>
</p>
</div>
</td>
<td style="vertical-align: middle;" class=" sorting_1">
<div class="select2-container medium-cell" id="s2id_rolelink416"
style="float:left;">
<a href="javascript:void(0)" onclick="return false;" class="select2-choice"
tabindex="-1">
<span class="select2-chosen">PROFILE ADMIN</span>
<abbr class="select2-search-choice-close"></abbr>
<span class="select2-arrow">
<b></b>
</span>
</a>
<input class="select2-focusser select2-offscreen" id="s2id_autogen11"
type="text">
<div class="select2-drop select2-display-none select2-with-searchbox">
<div class="select2-search">
<input autocomplete="off" autocorrect="off"
autocapitalize="off" spellcheck="false" class="select2-input"
type="text">
</div>
<ul class="select2-results">
</ul>
</div>
</div>
<select name="profileUsers.roleId" id="rolelink416"
class="medium-cell select2-offscreen" style="float:left;" tabindex="-1">
<option value="6">PROFILE ADMIN</option>
<option value="7">PROFILE AGENT</option>
<option value="8">PROFILE VIEWER</option>
<option value="196">profile role</option>
</select>
</td>
</tr>
</tbody>
</table>
providing the screen shots as well.
Try to use explicit wait with Expected Conditions
WebDriverWait wait = new WebDriverWait(driver, 10);
WebElement checkbox = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[#id='share_user']/tbody/tr[1]/td[1]//input")));
checkbox.click();
You can use the following expression, I have verified working fine.
driver.findElement(By.xpath("//*[#id='share_user']/tbody/tr[1]/td[1]/div")).click();
Try this
int ele_size=driver.findElements(By.xpath("locator")).size();
driver.findElements(By.xpath("locator")).get(ele_size-1).click();
We might encounter element not visible exception if element matching the locator existed in the DOM but is not currently visible. So we have to take the size of the element in first statement then in next statement we have to take the first element from the list and click on element.
Used this //*[#id='share_user']/tbody/tr[1]/td[1]/div worked

Unable to enter the value to input textbox

I need help solving how to enter the value to input text box associated with the table cell wrapped inside tables td
the html is:
<td role="gridcell">
<span style="width: 95px;" class="k-widget k-numerictextbox campaignBid">
<span class="k-numeric-wrap k-state-default">
<input type="text" class="k-formatted-value campaignBid k-input valid" tabindex="0" style="display: inline;" aria-disabled="false" aria-readonly="false">
<input type="text" style="display: none;" value="0.0079" class="campaignBid k-input valid" id="mb_2" data-role="numerictextbox" role="spinbutton" aria-valuemin="0.0079" aria-valuemax="1" aria-valuenow="0.0079" aria-disabled="false" aria-readonly="false">
<span class="k-select"><span class="k-link" unselectable="on"><span title="Increase value" class="k-icon k-i-arrow-n" unselectable="on">Increase value</span></span><span class="k-link" unselectable="on"><span title="Decrease value" class="k-icon k-i-arrow-s" unselectable="on">Decrease value</span>
</span>
</span>
</span>
</span>
</td>
I have tried using builder perform:
bvar = first(:xpath, "/td[7]/span/span/input")
builder=page.driver.browser.action
builder.key_down(:control).click(bvar.native).send_keys('a').send_keys("#{value}").perform
with a sleep of 1 second, but that does not work and i am not able to get the enter the value alone, every time the box adds "0." in the beginning of the code.
Any help will be highly appreciated.
<td role="gridcell"><span style="width: 95px;" class="k-widget k-numerictextbox campaignBid"><span class="k-numeric-wrap k-state-default"><input type="text" class="k-formatted-value campaignBid k-input valid" tabindex="0" style="display: inline;" aria-disabled="false" aria-readonly="false"><input type="text" style="display: none;" value="0.0079" class="campaignBid k-input valid" id="mb_2" data-role="numerictextbox" role="spinbutton" aria-valuemin="0.0079" aria-valuemax="1" aria-valuenow="" aria-disabled="false" aria-readonly="false"><span class="k-select"><span class="k-link" unselectable="on"><span title="Increase value" class="k-icon k-i-arrow-n" unselectable="on">Increase value</span></span><span class="k-link" unselectable="on"><span title="Decrease value" class="k-icon k-i-arrow-s" unselectable="on">Decrease value</span></span></span></span></span></td>
You should be simply doing
find(:xpath, "/td[7]/span/span/input[1]").set ""
find(:xpath, "/td[7]/span/span/input[1]").set "Your value"
First line to clear the existing value

Assistance with a dynamically generated field

I have another dynamic question for you. I have three input fields that I need to enter values for. These "dijit_form_DateTextBox_36" are created dynamically (the 36 is variable). There is a value earlier in the code that is unique and can be searched for. I know I need to use something like:
driver.findElement(By.xpath("//div[contains(., 'QA GM 04012014 1424 Item Name')]/parent::...somepath.sendKeys("...");
But I am still too new to this stuff to be able to figure it out. And if someone can assist me with what I need to put, as well as how they figured it out, I would greatly appreciate it. I'd really love to solve these on my own! Code is below. Bolded portion is the static text that can be searched. Bolded and italicized lines are the three controls that need to be modified. NOTE: The id="shipDate0_0" is also dynamic, it can be shipDate0_0, shipDate1_0, etc. So can't key on that.
<tr class="tableControlHeader twTableHeaderTR"></tr>
<tr class="tableControlDataRow evenRow twTableTR">
<td class="twTableTD details" align="center" rowspan="2"></td>
<td class="twTableTD details" align="center" rowspan="2">
<p>
<b>
QA GM 04012014 1424 Item Name
</b>
</p>
<br></br>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
</td>
<td class="twTableTD" align="center" rowspan="2"></td>
<td class="twTableTD" align="center"></td>
<td class="twTableTD" align="center"></td>
<td id="shipDate0_0" class="twTableTD" align="center">
<div style="padding-right: 20px;">
<div id="dateWrap-projectedFirstShipDate_0_0" class="inputText_Full twControl twDateSelector" ;="" onblur="updateAvgPerWeek(0,0)" initialvalue="" value="" name="tw#local#quoteComparison#0#country#0#projectedFirstShipDate" style="white-space:nowrap;">
<div id="projectedFirstShipDate_0_0" lang="" dojoattachpoint="pickerDiv" widgetid="projectedFirstShipDate_0_0" name="tw#local#quoteComparison#0#country#0#projectedFirstShipDate">
<span dojoattachpoint="leftPicker">
<div id="widget_dijit_form_DateTextBox_36" class="dijit dijitReset dijitInlineTable dijitLeft dateSelectionSin…tBox dijitComboBox dijitDateTextBox dijitComboBoxOpenOnClick" role="combobox" widgetid="dijit_form_DateTextBox_36">
<div class="dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonContainer" role="presentation" dojoattachpoint="_buttonNode, _popupStateNode" popupactive="true"></div>
<div class="dijitReset dijitValidationContainer"></div>
<div class="dijitReset dijitInputField dijitInputContainer">
<input id="dijit_form_DateTextBox_36" class="dijitReset dijitInputInner" type="text" aria-haspopup="true" role="textbox" dojoattachpoint="textbox,focusNode" autocomplete="off" aria-valuenow="null" aria-invalid="false" tabindex="0" value="" style="" delocalized="null" aria-disabled="false"></input>
<input type="hidden" value=""></input>
</div>
</div>
</span>
<span dojoattachpoint="rightPicker"></span>
<span style="position: absolute;" dojoattachpoint="calImage"></span>
<input id="projectedFirstShipDate_0_0" type="text" isdatefield="true" name="tw#local#quoteComparison#0#country#0#projectedFirstShipDate" style="display:none" dojoattachpoint="hiddenInput" delocalized="null"></input>
</div>
</div>
</div>
</td>
<td id="InDate0_0" class="twTableTD" align="center" ;="" onclick="updateAvgPerWeek(0,0)">
<div style="padding-right: 20px;">
<div id="dateWrap-inDate_0_0" class="inputText_Full twControl twDateSelector" ;="" onblur="updateAvgPerWeek(0,0)" initialvalue="" value="" name="tw#local#quoteComparison#0#country#0#inDate" style="white-space:nowrap;">
<div id="inDate_0_0" lang="" dojoattachpoint="pickerDiv" widgetid="inDate_0_0" name="tw#local#quoteComparison#0#country#0#inDate">
<span dojoattachpoint="leftPicker">
<div id="widget_dijit_form_DateTextBox_35" class="dijit dijitReset dijitInlineTable dijitLeft dateSelectionSin…tBox dijitComboBox dijitDateTextBox dijitComboBoxOpenOnClick" role="combobox" widgetid="dijit_form_DateTextBox_35">
<div class="dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonContainer" role="presentation" dojoattachpoint="_buttonNode, _popupStateNode" popupactive="true"></div>
<div class="dijitReset dijitValidationContainer"></div>
<div class="dijitReset dijitInputField dijitInputContainer">
<input id="dijit_form_DateTextBox_35" class="dijitReset dijitInputInner" type="text" aria-haspopup="true" role="textbox" dojoattachpoint="textbox,focusNode" autocomplete="off" aria-valuenow="null" aria-invalid="false" tabindex="0" value="" style="" delocalized="null" aria-disabled="false"></input>
<input type="hidden" value=""></input>
</div>
</div>
</span>
<span dojoattachpoint="rightPicker"></span>
<span style="position: absolute;" dojoattachpoint="calImage"></span>
<input id="inDate_0_0" type="text" isdatefield="true" name="tw#local#quoteComparison#0#country#0#inDate" style="display:none" dojoattachpoint="hiddenInput" delocalized="null"></input>
</div>
</div>
</div>
</td>
<td id="OutDate0_0" class="twTableTD" align="center" onclick="updateAvgPerWeek(0,0)">
<div style="padding-right: 20px;">
<div id="dateWrap-outDate_0_0" class="inputText_Full twControl twDateSelector" ;="" onblur="updateAvgPerWeek(0,0)" initialvalue="" value="" name="tw#local#quoteComparison#0#country#0#outDate" style="white-space:nowrap;">
<div id="outDate_0_0" lang="" dojoattachpoint="pickerDiv" widgetid="outDate_0_0" name="tw#local#quoteComparison#0#country#0#outDate">
<span dojoattachpoint="leftPicker">
<div id="widget_dijit_form_DateTextBox_34" class="dijit dijitReset dijitInlineTable dijitLeft dateSelectionSin…tBox dijitComboBox dijitDateTextBox dijitComboBoxOpenOnClick" role="combobox" widgetid="dijit_form_DateTextBox_34">
<div class="dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonContainer" role="presentation" dojoattachpoint="_buttonNode, _popupStateNode" popupactive="true"></div>
<div class="dijitReset dijitValidationContainer"></div>
<div class="dijitReset dijitInputField dijitInputContainer">
<input id="dijit_form_DateTextBox_34" class="dijitReset dijitInputInner" type="text" aria-haspopup="true" role="textbox" dojoattachpoint="textbox,focusNode" autocomplete="off" aria-valuenow="null" aria-invalid="false" tabindex="0" value="" style="" delocalized="null" aria-disabled="false"></input>
<input type="hidden" value=""></input>
</div>
</div>
</span>
<span dojoattachpoint="rightPicker"></span>
<span style="position: absolute;" dojoattachpoint="calImage"></span>
<input id="outDate_0_0" type="text" isdatefield="true" name="tw#local#quoteComparison#0#country#0#outDate" style="display:none" dojoattachpoint="hiddenInput" delocalized="null"></input>
</div>
</div>
</div>
</td>
<td id="BuyQuantity0_0" class="twTableTD" align="center" onblur="updateAvgPerWeek(0,0)" name="BuyQuantity0"></td>
<td id="TotalCost0_0" class="twTableTD" align="center" name="TotalCost0"></td>
<td id="NumberOfWarehouses0_0" class="twTableTD" align="center" onblur="updateAvgPerWeek(0,0)" td=""></td>
<!--
# of Warehouses
-->
<td id="AveragePerWarehouse0_0" class="twTableTD" align="center" name="AvgPerWhouseWeek0"></td>
<!--
Cost per Warehouse
-->`enter code here`
<td id="ProjectedSellPrice0_0" class="twTableTD" align="center" td=""></td>
<!--
Projected Sell Price
-->
<td id="PercentOfTotal0_0" class="twTableTD" align="center"></td>
<td class="twTableTD" align="center" rowspan="2"></td>
</tr>
The best xpath I am able to come up with is this:
//td[normalize-space()='QA GM 04012014 1424 Item Name']/following-sibling::td[contains(#id, 'shipDate')]//input[contains(#class,'dijitInputInner')]
Let me explain:
This part finds the td element with the text you're looking for, the normalize-space() call is just like text(), but trims any whitespace before/after the text & I've found it to be invaluable since discovering it a short time ago. text() will return whitespace and is often difficult to match
//td[normalize-space()='QA GM 04012014 1424 Item Name']
This next part finds ALL td's after the previous element. From the code snippet provided this will find ALL 13 td's that follow
/following-sibling::td
Narrow down that set of 13 by finding only the td containing the ID you're interested in, this is better than using a hardcoded number like /following-sibling::td[2] to find the second td
/following-sibling::td[contains(#id, 'shipDate')]
Then find the input field that you're interested in, there are number of ways you could do this, choose whichever you prefer
//input[contains(#class,'dijitInputInner')]
//input[contains(#id,'dijit_form_DateTextBox')]
I hope that's clear enough & works well for you, please let me know if not

Selenium locate <textbox> nested in <table td>

i want to select the specific textbox from a form based on its id attribute using selenium.
I tried this below code but its showing "unable to locate id..." error.
WebDriverWait waitt = new WebDriverWait(driver, 120);
waitt.until(ExpectedConditions.visibilityOfElementLocated(By.id("leadCaptureList_leadCapture_firstName")));
WebElement query = driver.findElement(By.xpath("//* [#id='leadCaptureList_leadCapture_firstName']"));`
and also i tried like WebElement textbox = driver.findElement(By.id("leadCaptureList_leadCapture_firstName")); but still no luck.
Is there anything in selenium to select nested textbox element ?
http://my.jetscreenshot.com/demo/20140304-c1dk-105kb.jpg (Press CTRL + to zoom image)
Here(in image) is the html structure of my page.
In this image i have highlighted the textbox for which i am trying to target.
html code as suggested in comment below
<table id="page-container" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody><tr>
<td id="page-header">
<div id="top">
<div id="page-title" class="limiter clear-block">
<div id="header-top">
<div id="logo"><img id="logo-image" alt="Home" src="images/logo.png"></div>
<div id="header-right">
<div id="block-ad" class="block block-ad">
<div class="block-content clear-block ">
</div>
</div>
<div id="header-links">
<!-- added table for structure -->
<table style="display:block; float:right;" class="norubik" border="0" cellpadding="1" cellspacing="0" width="100%">
<tbody><tr>
<td align="center"><font color="#666">My Account | <a style="color: red;font-size:10px;font-family:Verdana;color:#666;text-decoration: none" href="/logout">Logout</a></font></td>
</tr>
<tr>
<td align="center">
<span class="username"><!--Logged in as--> <strong>admin</strong>
<!-- Code for image -->
<div style="position:relative; top:2px; left:0px;">
<img src="images/premier_small.png">
</div>
</span>
</td>
</tr>
</tbody></table>
</div>
</div>
</div>
<div style="width: 100%; clear: both; text-align: left; margin-bottom: 6px; height:30px;">
<!-- begin menu div -->
<div class="AJXCSSMenuGdPbSLD"><!-- AJXFILE:ajxmenu.css -->
<div class="ajxmw">
<div class="ajxmw2">
<ul>
<li style="position: static;" class=""><a class="ajxsub" href="/" title="Home"><b>Home</b>
</a>
<div style="display: none;" class="ajxdd">
<div class="ajxsbg">
</div>
</div>
</li>
<li style="position: static;" class=""><a class="ajxsub" href="/node/3111" title="Getting Started"><b>Getting Started</b>
</a>
</li>
<li style="position: static;" class=""><a class="ajxsub" href="/node/2962" title="Training"><b>Training</b>
</a>
<div style="display: none;" class="ajxdd">
<div class="ajxsbg">
<ul>
<li style="position: static;" class=""><a class="ajxsub" href="/faq" title="FAQ">FAQ</a></li>
<li style="position: static;" class=""><a class="ajxsub" href="/node/3431" title="Video Tutorials">Video Tutorials</a></li>
<li style="position: static;" class=""><a class="ajxsub" href="/node/3138" title="Training Webinars">Training Webinars</a></li>
<li style="position: static;" class=""><a class="ajxsub" href="/pub/training-schedule" title="Training Schedule">Training Schedule</a></li>
<li style="position: static;" class=""><a class="ajxsub" href="/node/3735" title="Internet Marketing Webinars">Internet Marketing Webinars</a></li>
</ul>
</div>
</div>
</li>
<li style="position: static;" class=""><a class="ajxsub" href="/reseller/ir/leadCaptureList" title="Leads"><b>Leads</b>
</a>
</li>
<li style="position: static;" class=""><a class="ajxsub" href="/node/2964" title="Affiliate"><b>Affiliate</b>
</a>
</li>
<li style="position: static;" class=""><a class="ajxsub" href="/catalog/179" title="Store"><b>Store</b>
</a>
<div style="display: none;" class="ajxdd">
<div class="ajxsbg">
<ul>
<li style="position: static;" class=""><a class="ajxsub" href="/catalog/179" title="Memberships">Memberships</a></li>
<li style="position: static;" class=""><a class="ajxsub" href="/catalog/219" title="Marketplace">Marketplace</a></li>
</ul>
</div>
</div>
</li>
<li style="position: static;" class=""><a class="ajxsub" href="/" title="Resources"><b>Resources</b>
</a>
<div style="display: none;" class="ajxdd">
<div class="ajxsbg">
<ul>
<li style="position: static;" class=""><a class="ajxsub" href="/node/3017" title="Support">Support</a></li>
<li style="position: static;" class=""><a class="ajxsub" href="/reseller/calendar" title="Calendar/Events">Calendar/Events</a></li>
<li style="position: static;" class=""><a class="ajxsub" href="/node/3440" title="Documents">Documents</a></li>
<li style="position: static;" class=""><a class="ajxsub" href="/node/17" title="Documents">Documents</a></li>
<li style="position: static;" class=""><a class="ajxsub" href="/reseller/ir/contactInfo" title="Upline Report">Upline Report</a></li>
<li style="position: static;" class=""><a class="ajxsub" href="/node/3353" title="Feature Comparison">Feature Comparison</a></li>
<li style="position: static;" class=""><a class="ajxsub" href="/node/3497" title="Developer (API)">Developer (API)</a></li>
</ul>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
<!-- end menu div --></div>
</div>
<div id="branding">
<div class="limiter clear-block">
<div class="breadcrumb clear-block"><span class="breadcrumb-link">LeadOutcome</span> <span class="breadcrumb-link">Leads</span> <span class="breadcrumb-link">Manage Leads</span> </div>
</div>
</div>
</div>
</td>
</tr>
<tr>
<td id="content-container">
<div id="page" class="clear-block page-content">
<div id="content">
<div class="content-wrapper clear-block">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody><tr>
<td class="bhdr-container"><span class="bhdr"> Manage Leads </span></td>
</tr>
</tbody></table>
<span style="color: blue; font-weight: bold"></span>
<span style="color: red; font-weight: bold"></span>
<form id="leadCaptureList" name="leadCaptureList" action="leadCaptureList.action" method="post">
<div><input name="advanceSearchClicked" value="No" id="advanceSearchClicked" type="hidden">
</div><table class="wwFormTable">
<input name="leadsToTransfer" value="" id="leadsToTransferId" type="hidden">
<input name="deleteids" value="" id="leadCaptureList_deleteids" type="hidden">
<input name="leadOrIR" value="Lead" id="leadCaptureList_leadOrIR" type="hidden">
<input name="savedSearchCriteria.searchName" value="" id="leadCaptureList_savedSearchCriteria_searchName" type="hidden">
<input name="savedSearchCriteria.published" value="" id="leadCaptureList_savedSearchCriteria_published" type="hidden">
<input name="leadSearchName" value="" id="leadCaptureList_leadSearchName" type="hidden">
<input name="cfValuesFromSessOrDB" value="false" id="leadCaptureList_cfValuesFromSessOrDB" type="hidden">
</table><table class="hdr-section-search" border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<td> </td>
</tr>
<tr>
<td>
<table style="background-color: #F8F8F8" class="conbox4" border="0" cellpadding="2" cellspacing="0" width="100%">
<tbody><tr>
<th colspan="4"><font size="2">Search Options (Search criteria can be combined)</font></th>
<th colspan="6" align="right">
<select id="currentlyOwnedLeads" name="currentlyOwnedLeads">
<option value="All">All leads </option>
<option value="No">Show all leads ever owned by me </option>
<option value="Yes">Show only leads currently owned by me </option>
</select>
<input name="" value="All" id="currentlyOwnedIdUsedForJavascript" type="hidden">
<input name="coForManageLeads" id="selectedSalesRepCo" value="" type="hidden">
<input name="id" value="" id="leadCaptureList_id" type="hidden"> Sales Rep: <span id="selectedIrCompany"></span> <img src="images/btn_find_IR.png" border="0"></th>
<th colspan="3" align="center">
<span onmousemove="ddrivetip(receiveSummaryMouseover,150)" onmouseout="hideddrivetip()">Receive Lead Summary:<select name="receiveLeadManagementSummaryEmails" id="summaryMailsField" onchange="setReceiveLeadManagementSummaryEmails();">
<option value="false">No</option>
<option value="true" selected="selected">Yes</option>
</select>
</span>
</th>
</tr>
<tr>
<td align="right">Lead Id:</td>
<td><input name="leadIdForSearch" maxlength="7" value="" id="leadCaptureList_leadIdForSearch" style="width:80px" type="text"></td>
<td align="right">First Name:</td>
<td><input name="leadCapture.firstName" value="test Lo" id="leadCaptureList_leadCapture_firstName" style="width:80px" type="text"></td>
<td align="right">Last Name:</td>
<td><input name="leadCapture.lastName" value="" id="leadCaptureList_leadCapture_lastName" style="width:80px" type="text"></td>
<td align="right">Email:</td>
<td><input name="leadCapture.email" value="" id="leadCaptureList_leadCapture_email" style="width:80px" type="text"></td>
<td align="right">Phone No.:</td>
<td><input name="leadCapture.phone" value="" id="phoneNo" style="width:80px" type="text"></td>
<td align="right">Status:</td>
<td><select name="leadCapture.status" id="leadCaptureList_leadCapture_status">
<option value="">-- Select Status --</option>
<option value="New">New</option>
<option value="Converted">Converted</option>
</select>
</td>
</tr>
<tr id="advancedSearchRow1" style="display: none">
<td align="right">Company:</td>
<td><input name="leadCapture.company" value="" id="leadCaptureList_leadCapture_company" style="width:80px" type="text"> </td>
<td align="right">Address:</td>
<td><input name="leadCapture.address" value="" id="leadCaptureList_leadCapture_address" style="width:128px" type="text"></td>
<td align="right">City:</td>
<td><input name="leadCapture.city" value="" id="leadCaptureList_leadCapture_city" style="width:122px" type="text"></td>
<td align="right">State:</td>
<td><select name="leadCapture.state" id="leadCaptureList_leadCapture_state">
<option value="">-- Select State --</option>
<option value="AK">Alaska</option>
</select>
</td>
<td align="right">Zip Code:</td>
<td><input name="leadCapture.zip" value="" id="leadCaptureList_leadCapture_zip" style="width:80px" type="text"></td>
</tr>
<tr id="advancedSearchRow2" style="display: none">
<td align="right">Lead History:</td>
<td><input name="leadCapture.leadHistory" value="" id="leadCaptureList_leadCapture_leadHistory" style="width:80px" type="text"></td>
<td align="right">Category:</td>
<td><select name="leadCapture.leadCategory.id" id="leadCategorySearch1" style="width:122px">
<option value="0" selected="selected">All Leads</option>
<option value="2">Business Leads</option>
<option value="200">Webinar Follow up 12/4</option>
</select>
</td>
<td align="right">Custom Field Type:</td>
<td><select name="leadCapture.leadTypeObj.id" id="leadTypeId" style="width:122px" onclick="disableLeadType()" onchange="showCustomFields();">
<option value="0" selected="selected">-Select Type-</option>
<option value="16">Contacts</option>
<option value="139">ZMS: How can we help you?</option>
<option value="178">Gita</option>
<option value="206">111 test</option>
</select>
</td>
<td align="right">Interest :</td>
<td><input name="leadCapture.interest" value="" id="leadCaptureList_leadCapture_interest" style="width:80px" type="text">
</td>
<td align="right">Score :</td>
<td colspan="2">
<select name="scoreLogicalOperator" id="leadCaptureList_scoreLogicalOperator">
<option value="greater" selected="selected">Greater than</option>
<option value="less">Less than</option>
<option value="equal">Equal to</option>
</select>
<input name="serachByleadScore" value="" id="leadCaptureList_serachByleadScore" style="width:80px" type="text">
</td>
</tr>
<tr id="advancedSearchRow3" style="display: none">
<td align="right">Lead Source:</td>
<td><input name="leadCapture.leadSource" value="" id="leadCaptureList_leadCapture_leadSource" style="width:80px" type="text"></td>
<td align="right">Ad Code:</td>
<td><input name="leadCapture.adCode" value="" id="leadCaptureList_leadCapture_adCode" style="width:80px" type="text"></td>
<td colspan="8" align="right"></td>
</tr>
<tr>
<td colspan="3" align="right" width="250px;">
<img src="images/btn_m_save_search.png" id="saveLeadSearchId" onclick="return popUpForSaveLeadSearch();" align="absmiddle" border="0">
<select name="savedSearchCriteria.id" id="leadCaptureList_savedSearchCriteria_id" onclick="disableLeadSearch()" onchange="return selectSearchCriteriaByName();">
<option value="-1" selected="selected">--Select a search--</option>
</select>
</td>
<td colspan="6"><input style="display: none;" value="Delete Search" onclick="return deleteLeadSearchData();" id="deleteSearchButton" type="button"></td>
<td id="tdForAdvancedSearch" align="right"><img src="images/btn_m_show_advanced.png" border="0">
</td>
<td colspan="3" align="right"><input alt="true" src="images/btn_search.png" id="leadCaptureList_searchBtn" name="searchBtn" value="true" onclick="$('#pageNumber').val(1);return validSearchField();" type="image">
<input alt="Submit" src="images/btn_m_clear_search.png" id="leadCaptureList_0" value="Submit" onclick="clearAllSearchFields();" type="image">
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
<div id="customFieldsDiv"></div>
<input name="noOfLeadsToBeDisplayed" value="250" id="noOfLeadsToBeDisplayedId" type="hidden">
<input name="pagination" value="" id="pagination" type="hidden">
<input name="pageNumber" value="1" id="pageNumber" type="hidden">
<input name="backButton" value="false" id="backButton" type="hidden">
<input name="nextButton" value="false" id="nextButton" type="hidden">
<input name="saveSearchFlag" value="false" id="leadCaptureList_saveSearchFlag" type="hidden">
</form></div>
</div></div></td></tr></tbody></table>
Finding a textbox which has an id attribute should practically not fail. Selenium WILL find it if it's there. In case if the element is not present / visible in the DOM when the findElement command gets executed then Selenium will throw an exception.
You can try WebDriver explict wait like this and see if it works:
WebElement textBox = (new WebDriverWait(driver, 10))
.until(ExpectedConditions.visibilityOfElementLocated(By.id("leadCaptureList_leadCapture_firstName")));