2017-03-16 73 views
0

嘗試使用xpathcssidhref,部分文本,link文本沒有什麼工作 是沒有返回文本的頁面上存在無法點擊使用硒鏈接webdriver的

想點擊質量中心

如何點擊請幫我

下面是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> 
+1

請gothrough https://stackoverflow.com/help/how-to-ask,使人們可以幫助你。請分享你已經嘗試過的/ html網頁或網址的代碼,以便其他人可以瞭解問題和幫助 – thebadguy

+0

如果你把HTML放在你的問題中,你需要將它格式化爲代碼(選擇它並按下control + k ),否則它不會出現在問題上。 –

+0

對於stackoverflow是新的,對不起,如果我沒有遵循適當的規則問問題,接下來會維護。 –

回答

0

在C#中,你可以這樣做:

var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(5)); 
wait.Until(ExpectedConditions.ElementExists(By.Id("CertStatusRpt"))); 
driver.FindElement(By.Id("CertStatusRpt")).Click(); 
相關問題