在MSCRM 2013的查找字段上执行Selenium自动化 [英] Doing Selenium Automation on Lookup Field of MSCRM 2013
问题描述
我无法在MSCRM的查找字段上执行硒脚本
I am Unable to execute the selenium script on lookup FIeld of MSCRM
我正在尝试从MSCRM 2011的查找列表中选择一个项目,这与下拉列表不同.如果单击查找字段上的查找图像,则将打开一个新窗口.在新窗口中,显示记录列表,用户必须通过单击对应的复选框来选择特定记录,然后单击确定"按钮.最后,所选记录将出现在查找"字段中.
I am trying to select an item from lookup list in MSCRM 2011, it is not like drop down list. If you click the lookup image on the lookup field then a new window will open. In the new window a list of records is displayed and user has to select the particular record by clicking on the check-box corresponding to it and then click OK Button. Finally the selected record will appear in Lookup field.
查找字段的DOM结构
<td class="Lookup_RenderButton_td" style="width: 21px">
<img id="customerid" class="ms-crm-ImageStrip-btn_off_lookup ms-crm-Lookup" defaultviewid="{A9AF0AB8-861D-4CFA-92A5-C6281FED7FAB}" savedquerytype="" isdisplayonly="false" resolveemailaddress="0" showproperty="1" disableviewpicker="0" disablequickfind="0" disablemru="0" allowfilteroff="1" autoresolve="1" defaulttype="1" lookupstyle="single" lookupbrowse="0" lookuptypeicons="/_imgs/ico_16_1.gif?ver=1287191314:/_imgs/ico_16_2.gif?ver=1287191314" lookuptypenames="account:1:Account,contact:2:Contact" crmattributeid="{09d25a7a-420f-42f7-bad4-192edc51356a}" lookuptypes="1,2" attrpriv="7" attrname="customerid" style="ime-mode:auto" req="2" alt="Click to select a value for Customer Name." src="/_imgs/btn_off_lookup.png" title="Click to select a value for Customer Name." forcesubmit="false">
<a tabindex="-1" onclick="Mscrm.Utilities.click(previousSibling);" href="#" title="Click to select a value for Customer Name."></a>
</td>
和下面是新建"窗口的DOM结构,其中包含一组CheckBoX记录
and Below is DOM Structure of New window which contains set of CheckBoX Records
<div>
<table id="gridBodyTable" class="ms-crm-List-Data" cellspacing="0" cellpadding="1" border="1" style="border-style:None;border-collapse:collapse;" summary="This list contains 50 Account records." primaryfieldname="name" tabindex="6" numrecords="50" oname="1" allrecordscounted="0" totalrecordcount="5000" morerecords="1" rules="rows">
<colgroup>
<thead>
<tbody>
<tr class="ms-crm-List-Row" otypename="account" otype="1" oid="{BF593B9E-E115-E511-8B6D-E4115BDF9DFD}">
<td class="ms-crm-List-NonDataCell" align="center">
<input id="checkBox_{BF593B9E-E115-E511-8B6D-E4115BDF9DFD}" class="ms-crm-RowCheckBox" type="checkbox" style=" " title=" MEXPrueba Compañia Número 1 " tabindex="6">
</td>
我是堆栈溢出的新手,因此无法上传问题图片.但是对于单击以查找"字段,我已在行下方写上了
I am new to stack overflow so can't Upload the Image of the Issue. But for Click to Lookup Field I have Written Below Line :
driver.findElement(By.id("customerid")).click();
Below Lines are for getting into new window
driver.switchTo().defaultContent();
handles = driver.getWindowHandles();
for(String hnd : handles)
{
if(!hnd.equals(handle))
{
driver.switchTo().window(hnd);
}
}
System.out.println(driver.getTitle());
下面的行用于选择复选框
and Below Line is for selecting check box
driver.findElement(By.xpath("//table/tbody/tr[2]/td[1]/input")).click();
对于查找工作",您可以检查链接下方"
for Lookup Working you can check Below Link