I am trying to locate a pesky button on my webpage. most of the other elements I can locate but this one is giving me a headache.
The html is:
<table class="d_FG" role="presentation">
<tbody>
<tr>
<tr id="z_t">
<td class="fct_w" colspan="2">
<div>
<input name="newAttachments_fsid" value="0" type="hidden">
<table id="z_u" class="dcs" role="presentation">
<tbody>
<tr style="border: none;">
<td colspan="3" style="padding-right:0">
<a id="z_v" class="vui-button d2l-button d2l_1_192_930" role="button" tabindex="0" aria-disabled="false">Add a File</a>
<a id="z_w" class="vui-button d2l-button d2l_1_193_372" role="button" tabindex="0" aria-disabled="false">Record Audio</a>
</td>
<td></td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
I am trying to locate the element:
<a id="z_v" class="vui-button d2l-button d2l_1_192_930" role="button" tabindex="0" aria-disabled="false">Add a File</a>
I have tried various methods such as:
public void add_attachment(){
driver.switchTo().defaultContent();
try {
Thread.sleep(2000);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
driver.findElement(By.id("z_v"))).click();
}
But just cant manage it. Always get the message it is not visible or another element would be clicked.
I tried using a javascript that scrolls down to the element but that didn't work. Any ideas to help me with would be greatly appreciated
Can you try some other workarounds like using Actions or javascriptExecutor as below,
WebElement btn = driver.findElement(By.id("z_v")));
Actions action = new Actions(driver);
action.click(btn).build.perform();
or
JavascriptExecutor js = (JavascriptExecutor)driver;
Js.executeScript("arguments[0].click()",btn);
I am trying Count total number of rows.
I need to count the different type of status available (Inactive,Active,Expired & Exhausted)
Current code is only fetching:
Count of rows
Text of Status and Name but I need only count written next to Status type.
It only fetch data from first page. Pages are populated based on the number transactions.
following is the code written:
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class counting {
public static void main(String[] args) {
String Status="Inactive";
//String NextPage="Inactive";
WebDriver driver= new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.manage().window().maximize();
driver.navigate().to("http://Testsite/web");
driver.findElement(By.id("UserEntry")).sendKeys("00");
//Type Last Name
driver.findElement(By.id("Password")).sendKeys("Test");
// Click on Submit
driver.findElement(By.id("LoginButton")).click();
driver.findElement(By.linkText("Accounts"));
driver.findElement(By.linkText("Accounts")).click();
driver.findElement(By.xpath("html/body/form/div[3]/div/div[2]/table /tbody/tr/td[1]/div/ul/li[2]/a")).click();
List<WebElement> Account = driver.findElements(By.xpath("//table[#id='MainPlaceholder_AccountList']/tbody/tr/td[1]"));
List<WebElement> AccountStatus = driver.findElements(By.xpath("//table[#id='MainPlaceholder_AccountList']/tbody/tr/td[5]"));
System.out.println("Total Account- "+Account.size());
System.out.println("Total Status- "+AccountStatus.size());
Your code isn't fully formatted properly. I have used Appium (so it is selenium backend) for mobile tests and I am going to assume you could try to create a table that reaches to a certain point, and then rows that are composed of a certain className (or in your case I suppose a id value).
Ex:
table = (MobileElement) driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[2]/UIATableView[1]"));
rows = table.findElementsByClassName("UIATableCell");
The driver being a IOSDriver. Now this is how I locate certain elements for the iOS tests. But again, I am going to assume the logic is the same. Once you locate what you need, just populate your array with the objects.
Once you populate your array you could probably parse it to fit your needs.
for(int i=0;i<AccountStatus.size();i++){
if(AccountStatus.get(i).getText().equals(Status))
System.out.println(Account.get(i).getText()+" --- "+AccountStatus.get(i).getText());
}
}
}
HTML COde:
<table id="MainPlaceholder_AccountList" cellspacing="1" cellpadding="10" border="1" style="background-color:#888888;width:100%;font-size: 75%; padding: 5px;" rules="all">
<tbody>
<tr align="center" style="color:White;background-color:#232356;">
<th scope="col">Account Name</th>
<th scope="col">Number</th>
<th scope="col">Program</th>
<th scope="col">Site</th>
<th scope="col">Status</th>
<th scope="col">Edit</th>
<th scope="col">Delete</th>
</tr>
<tr style="background-color:White;">
<td class="capText" style="width:220px;">Last, First</td>
<td class="padIt" align="center" style="width:60px;">4563201</td>
<td class="capText" style="width:150px;"> </td>
<td class="padIt" style="width:115px;">local</td>
<td class="padIt" style="width:90px;">Active</td>
<td style="width:75px;">
<td style="width:75px;">
<td style="width:75px;">
<input id="MainPlaceholder_AccountList_EditAccount_0" type="submit" style="width:75px;" eid="550" value="Edit..." name="ctl00$MainPlaceholder$AccountList$ctl02$EditAccount">
</td>
<td style="width:75px;">
<input id="MainPlaceholder_AccountList_DeleteAccount_0" type="submit" style="width:75px;" eid="550" onclick="return confirm('Are you sure you want to delete the selected account?');" value="Delete" name="ctl00$MainPlaceholder$AccountList$ctl02$DeleteAccount">
</td>
td style="text-align: center">
<span id="MainPlaceholder_PageLabel" style="margin-right: 5px;">Page:</span>
<input id="MainPlaceholder_CurrentPage" type="text" style="width:40px;text-align: right" onclick="javascript:this.value="";" title="Type in a page number, then press the Enter key to go directly to that page." maxlength="5" value="1" name="ctl00$MainPlaceholder$CurrentPage">
<span id="MainPlaceholder_OfLabel" style="margin-left: 5px; margin-right: 5px;">of</span>
<span id="MainPlaceholder_TotalPages" style="margin-right: 5px;">21</span>
<input id="MainPlaceholder_LastButton" type="submit" style="height:24px;width:90px;" value="▼▼ Last" name="ctl00$MainPlaceholder$LastButton">
<input id="MainPlaceholder_NextButton" type="submit" style="height:24px;width:90px;" value="▼ Next" name="ctl00$MainPlaceholder$NextButton">
<input id="MainPlaceholder_PreviousButton" type="submit" style="height:24px;width:90px;" value="Previous ▲" name="ctl00$MainPlaceholder$PreviousButton">
<input id="MainPlaceholder_FirstButton" type="submit" style="height:24px;width:90px;" value="First ▲▲" name="ctl00$MainPlaceholder$FirstButton">
</td>
My Java
package com.ej.zob.modules;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
public class Manage_Branch {
public void Execute(String IFSC)
{
LaunchApplication.driver.findElement(By.linkText("MANAGE")).click();
LaunchApplication.driver.findElement(By.linkText("BRANCH")).click();
LaunchApplication.driver.findElement(By.xpath("//tbody/tr/td/div[text()='"+IFSC+"']"));
WebElement col = LaunchApplication.driver.findElement(By.xpath("//table/tbody/tr/td[count(//table/thead/tr/th[.='BRANCH NAME']/preceding-sibling::th)+4]"));
if(IFSC.equalsIgnoreCase(IFSC))
{
System.out.println(col.getText());
}
}
}
My HTML
<table id="flex1" cellspacing="0" cellpadding="0" border="0">
<thead>
<tr class="hDiv">
<th width="6%">
<div class="text-left field-sorting asc" rel="IFSC_CODE"> IFSC CODE </div>
</th>
<th width="6%">
<div class="text-left field-sorting " rel="BRANCH_NAME"> BRANCH NAME </div>
</th>
</tr>
</thead>
<tbody>
<tr>
<td class="sorted" width="6%">
<div class="text-left">SACS011151</div>
</td>
<td width="6%">
<div class="text-left">check</div>
</td>
</tr>
<tr class="erow">
<td class="sorted" width="6%">
<div class="text-left">SACS011152</div>
</td>
<td width="6%">
<div class="text-left">Motiram</div>
</td>
</tr>
<tr class="erow">
<td class="sorted" width="6%">
<div class="text-left">SACS011158</div>
</td>
<td width="6%">
<div class="text-left">TESTNAME</div>
</td>
</tr>
</tbody>
</table>
I want to print value from column name "BRANCH NAME" say "check" but when user passes value of IFSC CODE say "SACS011151" then the value in front of that particular IFSC CODE should be printed.But in my case it is printing the value from 8th row only whatever the IFSC code you pass it is only taking "TESTNAME". For help you can see the above image for better understanding.I don't know why it is happening. Hope you understand Any help?
Try this:
WebElement col = LaunchApplication.driver.findElement(By.xpath("//thead//div[text()='+"IFSC"+']//../following-sibling::td/div"));
WebElement col = LaunchApplication.driver.findElement(By.tagName('tbody')).findElement(By.tagName('tr')).findElements(By.tagName('td'))[1]
Once try this:
WebElement col = LaunchApplication.driver.findElement(By.xpath("//tbody/tr[1]/td[1]/div[text()='SACS011151']"));
if(col.equals("SACS011151")){
WebElement branchNameEle = LaunchApplication.driver.findElement(By.xpath("//tbody/tr[1]/td[4]"));
System.out.println("BranchName: "+branchNameEle.getText());
}
I have an element that looks like combo box ( DevEx control ). Its Tag is input and not Select. Hence Select command does not work. I can locate that element and when send a click command, it opens the list. However, I am not able to select any Value from it.
Code snippet using firebug is as follows:
input id="ctl00_MainContent_tbc_UserRights_tbpnl_UserInfo_ddl_Company_I" class="dxeEditArea dxeEditAreaSys" type="text" style="cursor:default;" onchange="aspxETextChanged('ctl00_MainContent_tbc_UserRights_tbpnl_UserInfo_ddl_Company')" readonly="readonly" name="ctl00$MainContent$tbc_UserRights$tbpnl_UserInfo$ddl_Company" autocomplete="off" tabindex="14" onfocus="aspxEGotFocus('ctl00_MainContent_tbc_UserRights_tbpnl_UserInfo_ddl_Company')" onblur="aspxELostFocus('ctl00_MainContent_tbc_UserRights_tbpnl_UserInfo_ddl_Company'
Selenium Code is as Follows
WebElement companydropdown = driver.findElement(By.id("ctl00_MainContent_tbc_UserRights_tbpnl_UserInfo_ddl_Company_I")); Select Clickthis1 = new Select (companydropdown); clickThis.selectByVisibleText("Multi National Retail Group");
error is as follows
Exception in thread "main" org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "input" Build info: version: '2.45.0', revision: '32a636c', time: '2015-03-05 22:01:35' System info: host: 'ct-113', ip: '172.24.1.248', os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.8.0_45' Driver info: driver.version: unknown at org.openqa.selenium.support.ui.Select.(Select.java:46) at MyPackage.MyClass.main(MyClass``.java:113)
Your drop down list is being simulated by JavaScript. It's probably a DIV (or maybe a SELECT or TABLE) after clicking the input, so you will need to locate that new element after clicking the input.
There's no built in command. You may need to FindElement(By.CssPath("table[id*=ddl_Company] td:contains(Default Company)")) and click it
Please see below code snippet, I have written in c# but you can take this reference for any language.
Basic idea is to design logic to select elements from dropdown by using FindElement and FindElements.
Extension Method of IWebDriver
public static class SeleniumExtension
{
public static void SelectDropDownByText(this IWebDriver driver, string clickId, string tableId, string visibleText)
{
//Click on dropdown element to see dropdown options
driver.FindElement(By.Id(clickId)).Click();
//Get all rows from the table(dropdown options table) by tableId
var trElements = driver.FindElement(By.Id(tableId)).FindElements(By.CssSelector("tr"));1
//Go to row by row
foreach(var trElement in trElements)
{
//Select celll(td) of the row
var tdElement = trElement.FindElement(By.CssSelector("td"));
//Scoll to that td so we can select the td
Actions actions = new Actions(driver);
actions.MoveToElement(tdElement);
actions.Perform();
//CHeck td text if td text is equal to given text then click that td
if (tdElement.Text.Trim() == visibleText.Trim())
{
//Select td/dropdown option
tdElement.Click();
break;
}
}
}
}
Limitations:-
The dropdown items should not have duplicate text elements
Just found one way to select it by visible text, not by Id or Value
Code example :
Web page source code
<td width="55%" valign="top" align="left">
<table class="dxeButtonEdit inputBox" cellspacing="1" cellpadding="0" id="EnterOrderModel.reportstoprofs" style="width:150px;">
<tbody>
<tr>
<td style="display:none;"><input id="EnterOrderModel.reportstoprofs_VI" name="EnterOrderModel.reportstoprofs_VI" type="hidden" value="AAAA"></td>
<td class="dxic" onmousedown="return aspxDDDropDown('EnterOrderModel.reportstoprofs', event)" style="width:100%;padding-left:1px;padding-right:1px;padding-top:1px;padding-bottom:1px;"><input class="dxeEditArea dxeEditAreaSys" id="EnterOrderModel.reportstoprofs_I" name="EnterOrderModel.reportstoprofs" onfocus="aspxEGotFocus('EnterOrderModel.reportstoprofs')" onblur="aspxELostFocus('EnterOrderModel.reportstoprofs')" onchange="aspxETextChanged('EnterOrderModel.reportstoprofs')" onkeydown="aspxEKeyDown('EnterOrderModel.reportstoprofs', event)" value="Parmnad(AAAA)" type="text" style="height:15px;" autocomplete="off"></td>
<td id="EnterOrderModel.reportstoprofs_B-1" class="dxeButtonEditButton" onmousedown="return aspxDDDropDown('EnterOrderModel.reportstoprofs', event)" style="-khtml-user-select:none;">
<table class="dxbebt" cellspacing="0" cellpadding="0" style="border-collapse:collapse;border-collapse:separate;">
<tbody>
<tr>
<td class="dx"><img id="EnterOrderModel.reportstoprofs_B-1Img" class="dxEditors_edtDropDown" src="/DXR.axd?r=1_5-7rgYm" alt="v"></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<input type="hidden" id="EnterOrderModel.reportstoprofs_DDDWS" name="EnterOrderModel.reportstoprofs_DDDWS" value="0:0:-1:-10000:-10000:0:-10000:-10000:1">
<div id="EnterOrderModel.reportstoprofs_DDD_PW-1" style="position:absolute;left:0px;top:0px;z-index:10000;visibility:hidden;display:none;">
<table id="EnterOrderModel.reportstoprofs_DDD_PWST-1" cellspacing="0" cellpadding="0" style="border-collapse:collapse;border-collapse:separate;position:relative;">
<tbody>
<tr>
<td onmousedown="aspxPWMDown(event,'EnterOrderModel.reportstoprofs_DDD',-1,false)" style="width:200px;cursor:default;">
<table id="EnterOrderModel.reportstoprofs_DDD_CLW-1" cellspacing="0" cellpadding="0" style="width:200px;border-collapse:collapse;border-collapse:separate;">
<tbody>
<tr>
<td id="EnterOrderModel.reportstoprofs_DDD_PWC-1" style="height:100%;">
<div id="EnterOrderModel.reportstoprofs_DDD_CSD-1">
<input type="hidden" id="EnterOrderModel.reportstoprofs_DDD_LDeletedItems" name="EnterOrderModel.reportstoprofs_DDD_LDeletedItems" value=""><input type="hidden" id="EnterOrderModel.reportstoprofs_DDD_LInsertedItems" name="EnterOrderModel.reportstoprofs_DDD_LInsertedItems" value=""><input type="hidden" id="EnterOrderModel.reportstoprofs_DDD_LCustomCallback" name="EnterOrderModel.reportstoprofs_DDD_LCustomCallback" value="">
<table class="dxeListBox" cellspacing="0" cellpadding="0" id="EnterOrderModel.reportstoprofs_DDD_L" style="border-collapse:collapse;border-collapse:separate;">
<tbody>
<tr>
<td valign="top">
<div id="EnterOrderModel.reportstoprofs_DDD_L_D" class="dxlbd" style="width:100%;overflow-x:hidden;overflow-y:auto;">
<input id="EnterOrderModel.reportstoprofs_DDD_L_VI" type="hidden" name="EnterOrderModel.reportstoprofs$DDD$L" value="AAAA">
<table cellspacing="0" cellpadding="0" style="border-collapse:collapse;border-collapse:separate;visibility:hidden!important;display:none!important;">
<tbody>
<tr id="EnterOrderModel.reportstoprofs_DDD_L_LBI-1" class="dxeListBoxItemRow">
<td id="EnterOrderModel.reportstoprofs_DDD_L_LBI-1T0" class="dxeListBoxItem"> </td>
</tr>
</tbody>
</table>
<div id="EnterOrderModel.reportstoprofs_DDD_L_TS" style="display: none;">
</div>
<table id="EnterOrderModel.reportstoprofs_DDD_L_LBT" cellspacing="0" cellpadding="0" style="width:100%;border-collapse:collapse;border-collapse:separate;">
<tbody>
<tr class="dxeListBoxItemRow">
<td class="dxeListBoxItem" id="EnterOrderModel.reportstoprofs_DDD_L_LBI0T0">Select One</td>
</tr>
<tr class="dxeListBoxItemRow">
<td class="dxeListBoxItem" id="EnterOrderModel.reportstoprofs_DDD_L_LBI1T0">Macccc Dongle</td>
</tr>
<tr class="dxeListBoxItemRow">
<td class="dxeListBoxItem" id="EnterOrderModel.reportstoprofs_DDD_L_LBI2T0">Rock Start</td>
</tr>
<tr class="dxeListBoxItemRow">
<td class="dxeListBoxItem" id="EnterOrderModel.reportstoprofs_DDD_L_LBI3T0">Alliau babbaa</td>
</tr>
<tr class="dxeListBoxItemRow">
<td class="dxeListBoxItem" id="EnterOrderModel.reportstoprofs_DDD_L_LBI4T0">Mong star audomma</td>
</tr>
</tbody>
</table>
<div id="EnterOrderModel.reportstoprofs_DDD_L_BS" style="display: none;">
</div>
</div>
</td>
</tr>
</tbody>
</table>
<script id="dxss_1356993039" type="text/javascript">
<!--
aspxAddDisabledItems('EnterOrderModel.reportstoprofs_DDD_L',[[['dxeDisabled'],[''],['']]]);
var dxo = new ASPxClientListBox('EnterOrderModel.reportstoprofs_DDD_L');
window['EnterOrderModel.reportstoprofs_DDD_L'] = dxo;
dxo.uniqueID = 'EnterOrderModel.reportstoprofs$DDD$L';
dxo.SelectedIndexChanged.AddHandler(function (s, e) { aspxCBLBSelectedIndexChanged('EnterOrderModel.reportstoprofs', e); });
dxo.ItemClick.AddHandler(function (s, e) { aspxCBLBItemMouseUp('EnterOrderModel.reportstoprofs', e); });
dxo.RequireStyleDecoration();
dxo.styleDecoration.AddStyle('F','dxeFocused','');
dxo.savedSelectedIndex = 9;
dxo.itemsValue=['','SFIRTH','TANDE142','BBECK12','KBELLEGH','NBISSON','EBOLDUC','GBORSCHK','GBRISCOE','AAAA','PCAMERON','DCANTAGA','RCARROL2','SCAUVEL','GCAVE1','KCHRIST2','DCOLAPRE','HCUSHMAN','TDENNING','RDERHODG','ADUCHARM','REATON','TERB','MFARLEY4','EFERRELL','DFORTUNA','CFRADET','GGIOVINA','BGOLDBER','BGOODMA1','RGRAMADA','JGUBERNE','JHARTFO2','MHERNIAK','MHORNE3','MHUGGIN1','CHUNT21','JINTRAVA','PJANSEN1','RKANTAUT','DKELLETT','WKIRK1','LKOZMA','VKUSUMAK','RLAURILA','JLEACH1','KLEBLANC','FLEE2','BLESSARD','JMCCAMON','AMCCORM2','TNISSEN','JOLOMAN','EPAHAPI1','APETRIE1','ZRACZ','MRONAN','WROWE2','PROY','TSAVONI','JSNYDER5','LSTIERS','KSTRONG1','GTAIARIO','JTJONG','DTOTTEN','MTRENK1','CTURGEON','JVELLING','PWALWORT','WWELACKY','EWEST2','BWHITE7','SWHITEHE','BWILLI15','DWILLIA3','GWOOD5','KWOODBRI','MYETHON'];
dxo.isSyncEnabled = false;
dxo.isComboBoxList = true;
dxo.hasSampleItem = true;
dxo.isCallbackMode = true;
dxo.callbackPageSize = 100;
dxo.hoverClasses=['dxeListBoxItemHover'];
dxo.selectedClasses=['dxeListBoxItemSelected'];
dxo.disabledClasses=['dxeDisabled'];
dxo.InlineInitialize();
//-->
</script>
</div>
</td>
</tr>
</tbody>
</table>
</td>
<td style="background:url('/DXR.axd?r=1_25-7rgYm') no-repeat left top;"></td>
</tr>
<tr>
<td style="background:url('/DXR.axd?r=1_24-7rgYm') no-repeat left top;"></td>
<td style="background:url('/DXR.axd?r=1_26-7rgYm') no-repeat left top;">
<div style="height:5px;width:5px;">
</div>
</td>
</tr>
</tbody>
</table>
</div>
<script id="dxss_452203440" type="text/javascript">
<!--
var dxo = new ASPxClientPopupControl('EnterOrderModel.reportstoprofs_DDD');
window['EnterOrderModel.reportstoprofs_DDD'] = dxo;
dxo.uniqueID = 'EnterOrderModel.reportstoprofs$DDD';
dxo.Shown.AddHandler(function (s, e) { aspxDDBPCShown('EnterOrderModel.reportstoprofs', e); });
dxo.adjustInnerControlsSizeOnShow=false;
dxo.closeAction='CloseButton';
dxo.popupHorizontalAlign='LeftSides';
dxo.popupVerticalAlign='Below';
dxo.width=0;
dxo.height=0;
dxo.InlineInitialize();
//-->
</script>
<table id="EnterOrderModel.reportstoprofs_LP" class="dxeLoadingPanel" cellspacing="0" cellpadding="0" style="border-collapse:collapse;left:0px;top:0px;z-index:30000;display:none;">
<tbody>
<tr>
<td class="dx" style="padding-right:8px;"><img src="/DXR.axd?r=2_24-7rgYm" alt="" align="middle"></td>
<td class="dx" style="padding-left:0px;">Loading…</td>
</tr>
</tbody>
</table>
<div id="EnterOrderModel.reportstoprofs_LD" class="dxeLoadingDiv" style="left:0px;top:0px;z-index:29999;display:none;position:absolute;">
</div>
<script id="dxss_1042248493" type="text/javascript">
<!--
aspxAddHoverItems('EnterOrderModel.reportstoprofs',[[['dxeButtonEditButtonHover'],[''],['B-1'],,[['']],['Img']]]);
aspxAddPressedItems('EnterOrderModel.reportstoprofs',[[['dxeButtonEditButtonPressed'],[''],['B-1'],,[['']],['Img']]]);
aspxAddDisabledItems('EnterOrderModel.reportstoprofs',[[['dxeDisabled'],[''],['','I']],[['dxeDisabled dxeButtonDisabled'],[''],['B-1'],,[[{'spriteCssClass':'dxEditors_edtDropDownDisabled'}]],['Img']]]);
document.getElementById("EnterOrderModel.reportstoprofs_I").setAttribute("autocomplete", "off");
var dxo = new MVCxClientComboBox('EnterOrderModel.reportstoprofs');
window['EnterOrderModel.reportstoprofs'] = dxo;
dxo.callBack = function(arg) { ; };
dxo.RequireStyleDecoration();
dxo.styleDecoration.AddStyle('F','dxeFocused','');
dxo.incrementalFilteringMode='StartsWith';
dxo.isCallbackMode = true;
dxo.lastSuccessValue = 'AAAAA';
dxo.islastSuccessValueInit = true;
dxo.unobtrusiveValidationAttributes=eval(({'data-val-required':'Required','data-val':'true'}));
dxo.callbackUrl="/en-US/Orders/EnterOrder/ReportsToProf";
dxo.InlineInitialize();
//-->
</script>
<span class="commentText">*</span>
<span class="field-validation-valid" data-valmsg-for="EnterOrderModel.reportstoprofs" data-valmsg-replace="true"></span>
</td>
Selenium code to handle this complex dropdown selection
_driver is a variable of IWebDriver before use you have to initiate it e.g IWebDriver _driver = new ChromeDriver();
_driver.SelectDropDownByText(
clickId:"EnterOrderModel.reportstoprofs_B-1",
tableId:"EnterOrderModel.reportstoprofs_DDD_L_LBT",
visibleText:"Macccc Dongle");