通过Selenium Webdriver从MSCRM仪表板打开记录

时间:2015-08-12 10:20:44

标签: java selenium-webdriver automation dynamics-crm

我正在编写脚本以打开来自 MSCRM 2011 Dash Board 的记录。这些记录在表格中排列为框架内的复选框。因此,双击Checkbox Record Page将打开

以下是我得到的例外

java.util.NoSuchElementException
    at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(Unknown Source)
    at java.util.LinkedHashMap$KeyIterator.next(Unknown Source)
    at Ford_Account.main(Ford_Account.java:112)

以下是Webdriver代码

WebElement link = w1.findElement(By.xpath("html/body/div[5]/div[1]/div[2]/span/ul/li[2]/ul/li[1]/a[1]"));  //COntact click
link.click();

w1.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
try {
    windows= w1.getWindowHandles();
    iterator=windows.iterator();

    while((iterator.hasNext())){
        parent=iterator.next();
        child=iterator.next();
        w1.switchTo().window(child);
        System.out.println("Swicthed to child");
        Thread.sleep(1000);
    }
    w1.switchTo().frame("contentIFrame");

    Actions ac = new Actions(w1);
    WebElement element = (WebElement) ac.moveToElement(w1.findElement(By.id("checkBox_{EE9744AC-6737-E511-8459-E4115BDF9DFD}")));
    ac.doubleClick(element).perform(); 

我在

上遇到异常
child=iterator.next();

以下是HTML结构

<iframe id="contentIFrame" frameborder="0" name="contentIFrame" style="border: 0px none; overflow: hidden; position: absolute; left: 0px; right: 0px; height: 100%; width: 100%; opacity: 1; display: inline;" title="Content Area" src="/_root/homepage.aspx?etc=1&pagemode=iframe&sitemappath=CS%7cCS%7cnav_accts&whr=https%3a%2f%2fmscrm00b.hpuscrmpoc.com%2fadfs%2fservices%2ftrust">
<!DOCTYPE html>
<html webdriver="true">
<head>
<body class="stage">
<div class="stdTable">
<span id="__Page_crmEventManager" style="display:block;height:0px;"></span>
<div></div>
<div>
<div style="height:0px;">
<div id="homepageTableCell" class="ms-crm-absolutePosition" style="top:27px;">
<div class="ms-crm-IE7-Height-Fix-Dummy-Container">
<div id="crmGrid_visualizationCompositeControl" style="height:100%;">
<div id="crmGrid_compositeControl" style="height:100%;width:100%;position:relative;">
<div id="crmGrid_crmGridStrip" class="ms-crm-CC-GridSS-All-0-LR">
<div id="crmGrid_crmGridTD" class="ms-crm-CC-grid-All-0-LR">
<div class="ms-crm-IE7-Height-Fix-Dummy-Container">
<div id="crmGrid_filterSet" gridid="crmGrid"></div>
<div class="ms-crm-grid-BodyContainer" style="width:100%;height:100%;position:relative;overflow:hidden;">
<div id="crmGrid" class="ms-crm-ListControl" type="crmGrid">
<div class="ms-crm-grid-body" style="bottom:25px;">
<div class="ms-crm-IE7-Height-Fix-Dummy-Container">
<div id="crmGrid_gridBodyContainer" class="ms-crm-grid-BodyContainer" style="height:100%;position:relative">
<div id="refreshButton" class="ms-crm-List-RefreshButton" style="left: auto; right: 0px; display: inline;">
<div class="ms-crm-ListArea" style="position:relative">
<div class="ms-crm-grid-BodyContainer" style="height:22px;OVERFLOW-X:hidden;">
<div class="ms-crm-grid-databodycontainer" style="top:22px;bottom:22px;vertical-align:top">
<div class="ms-crm-IE7-Height-Fix-Dummy-Container">
<div id="crmGrid_divDataBody" class="ms-crm-List-DataBody">
<div id="crmGrid_divDataArea" class="ms-crm-List-DataArea" expandable="0">
<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 7 Account records." primaryfieldname="name" tabindex="0" numrecords="7" oname="1" allrecordscounted="1" totalrecordcount="7" morerecords="0" rules="rows">
<colgroup>
<thead>
<tbody>
<tr class="ms-crm-List-Row" otypename="account" otype="1" oid="{21C2F87E-9E36-E511-8459-E4115BDF9DFD}">
<td class="ms-crm-List-NonDataCell" align="center">
<input id="checkBox_{21C2F87E-9E36-E511-8459-E4115BDF9DFD}" class="ms-crm-RowCheckBox" type="checkbox" style=" " title="ford Account123" tabindex="0">
</td>

任何人都可以建议我如何从MSCRM 2011的仪表板打开记录

0 个答案:

没有答案