尝试使用xpath
,css
,id
,href
,部分文字,link
文字无效
返回页面上没有文字存在
想要点击Quality Center
如何点击请帮帮我
下面是我试过的html代码: -
<document>
<html>
<head>
<body class="Nav">
<a id="Cahill_Line" href="Cahill Line" onclick="highlight('Cahill_Line')" target="" title="</a><HR>"/>
<hr/>
<br/>
<a id="Help" href="javascript:LoadPage('3001', 'https://wiki.ucern.com/display/ipfactory/Revision%2bInfo%2bHelp'); void(0);" onclick="highlight('Help')" target="" title="Help"> Help</a>
<br/>
<a id="Processing_Info" href="javascript:toggle('divProcessing_Info', 'Processing_Info','WebHelp/processing_info.htm');" title="Build Processing">Build Processing</a>
<br/>
<div id="divProcessing_Info" class="indent" style="DISPLAY: none;">
<a id="FT_Reports" href="javascript:toggle('divFT_Reports', 'FT_Reports','WebHelp/feature_tracker_reports.htm');" title="Feature Tracker">Feature Tracker</a>
<br/>
<div id="divFT_Reports" class="indent" style="DISPLAY: none;">
<a id="Maven2" href="javascript:toggle('divMaven2', 'Maven2','webhelp/maven2_reports.htm');" title="Maven2">Maven2</a>
<br/>
<div id="divMaven2" class="indent" style="DISPLAY: none;">
<a id="Navigator" href="javascript:toggle('divNavigator', 'Navigator','webhelp/navigator_reports.htm');" title="Navigator">Navigator</a>
<br/>
<div id="divNavigator" class="indent" style="DISPLAY: none;">
<a id="Pkg_Reports" href="javascript:toggle('divPkg_Reports', 'Pkg_Reports','WebHelp/package_reports.htm');" title="Package">Package</a>
<br/>
<div id="divPkg_Reports" class="indent" style="DISPLAY: none;">
<a id="CertStatusRpt" href="javascript:toggle('divCertStatusRpt', 'CertStatusRpt','WebHelp/cert_status_reports.htm');" title="Quality Center" style="font-weight: normal;">Quality Center</a>
答案 0 :(得分:0)
在C#中你可以这样做:
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(5));
wait.Until(ExpectedConditions.ElementExists(By.Id("CertStatusRpt")));
driver.FindElement(By.Id("CertStatusRpt")).Click();