Actions action = new Actions(driver); IWebElement we = driver.FindElement(By.XPath(".//*[@class='ms-crm-CommandBar-Button ms-crm-Menu-Label']"));
为什么我不能在这段代码中点击这个元素?
action.MoveToElement(driver.FindElement(By.XPath(".//*[@class='ms-crm-CommandBar-Button ms-crm-Menu-Label-Hovered']"))).Click().Build().Perform();
期望元素如下:
< span tabindex = "-1" class="ms-crm-CommandBar-Button ms-crm-Menu-Label" style="max-width: 200px;"> <a tabindex = "0" class="ms-crm-Menu-Label" onclick="return false"> <img tabindex = "-1" class="ms-crm-ImageStrip-New_16 ms-crm-commandbar-image16by16" style="vertical-align: top;" src="/_imgs/imagestrips/transparent_spacer.gif"> <span tabindex = "-1" class="ms-crm-CommandBar-Menu" [enter image description here][1]style="max-width: 150px;" command="lead|NoRelationship|HomePageGrid|Mscrm.NewRecordFromGrid"> New </span> <div class="ms-crm-div-NotVisible"> Create a new Lead record. </div>
</a> </span>
注意,此类"ms-crm-CommandBar-Button ms-crm-Menu-Label"
原来是"ms-crm-CommandBar-Button ms-crm-Menu-Label-Hovered"
当鼠标悬停。
非常感谢。
错误的复制和粘贴。其实,没有“。”盈方// –
跨度下也有 ... New Create a new Lead record. –
你好 - 欢迎来到SO--请阅读“如何提问”之前:https://stackoverflow.com/help/how-to-ask – Cadburry