我覺得這似乎是一個很老的問題。但實際上並不適合我。如何等待元素在angular.js應用程序中可見?
我的應用程序基於Angular。當Loader出現時立即登錄到應用程序,Selenium測試失敗並引發下面提到的錯誤異常。
unknown error: Element <a id="user_dropdown" href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown">...</a> is not clickable at point (1421, 33). Other element would receive the click: <md-backdrop ng-show="showMainSpinner" class="m-backdrop" aria-hidden="false">...</md-backdrop>
(Session info: chrome=58.0.3029.110)
(Driver info: chromedriver=2.28.455520
(cc17746adff54984afff480136733114c6b3704b),platform=Windows NT 10.0.14393
x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 56 milliseconds
Build info: version: '2.45.0', revision:
'5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27 09:10:26'
[Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities \[{applicationCacheEnabled=false, rotatable=false,
mobileEmulationEn][1]abled=false, networkConnectionEnabled=false, chrome=
{chromedriverVersion=2.28.455520
(cc17746adff54984afff480136733114c6b3704b),
userDataDir=C:\Users\smistry\AppData\Local\Temp\scoped_dir56852_17781},
takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false,
handlesAlerts=true, hasTouchScreen=false, version=58.0.3029.110,
platform=XP, browserConnectionEnabled=false, nativeEvents=true,
acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true,
browserName=chrome, takesScreenshot=true, javascriptEnabled=true,
cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]
Session ID: 41ebcec742d22c760f65efb4bb06b7db
事情我已經這樣做的遠來實現這一目標:用隱
1)等待
2)使用顯式的等待(WaitForElementPresent/WaitForVisible/elementToBeClickable /等元素等的隱形)(所有可能的嘗試)
3)使用Java Script(window.angular.element('body')。injector()。get('$ http')。pendingRequests.length === 0)
typeof運算的jQuery!= '未定義'
document.readystate
的typeof角!= '未定義')
4)嘗試捕捉元件(裝載機的每一種可能的方式),並等待它消失。根本沒有工作。
5)使用了Thread.sleep(但我不想使用它)
下面是代碼爲我的網站的微調元素:
<md-progress-circular md-mode="indeterminate" md-diameter="70" class="m-spinner md-raised md-hue-2 md-mode-indeterminate" aria-valuemin="0" aria-valuemax="100" role="progressbar" style="width: 70px; height: 70px;"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 70 70" style="width: 70px; height: 70px; transform-origin: 35px 35px 35px;"><path fill="none" style="stroke-width: 7px;" d="M21.583326164121,6.500125207614687A31.5,31.5 0 0,1 49.405589517818534,63.01301466540359"></path></svg></md-progress-circular>
我使用webdriver的硒,鉻58,日食neon.2,窗口10.
真的很努力,因爲最後這麼多天來得到它的解決方案。我希望你有我的問題。如果缺少任何東西,我可以提供詳細信息。幫助將不勝感激。
你有沒有看看[如何使用硒(硒或)如果DOM元素被角顯示檢測(https://stackoverflow.com/q/25141387/3429133)? – beatngu13
@ beatngu13謝謝頁面的建議。 我看了看那個頁面,沒有什麼幫助我擺脫它。 – Sunil
@Sunil你能考慮讓我們看看你的作品嗎?謝謝 – DebanjanB