0
以下小黃瓜正常工作與貝哈特但是當我使用PhantomJS我得到下面When I follow "Profile"
線錯誤時,下拉菜單上失敗:貝哈特工作正常,但PhantomJS試圖點擊
注:該元件是由自舉這麼一個下拉菜單它在點擊後切換。
錯誤:
Exception thrown by (//html/.//a[./@href][(((./@id = 'Profile' or contains(normalize-space(string(.)), 'Profile')) or contains(./@title, 'Profile') or contains(./@rel, 'Profile')) or .//img[contains(./@alt, 'Profile')])] | .//*[./@role = 'link'][((./@id = 'Profile' or contains(./@value, 'Profile')) or contains(./@title, 'Profile') or contains(normalize-space(string(.)), 'Profile'))])[1]
{"errorMessage":"Element is not currently visible and may not be manipulated","request":{"headers":{"Accept-Encoding":"gzip,deflate","Connection":"Keep-Alive","Content-Length":"27","Content-Type":"application/json; charset=utf-8","Host":"localhost:5140","User-Agent":"Apache-HttpClient/4.3.4 (java 1.5)"},"httpVersion":"1.1","method":"POST","post":"{\"id\":\":wdc:1412065547042\"}","url":"/click","urlParsed":{"anchor":"","query":"","file":"click","directory":"/","path":"/click","relative":"/click","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/click","queryKey":{},"chunks":["click"]},"urlOriginal":"/session/5b7c0830-487b-11e4-adc0-a162f25e4a98/element/%3Awdc%3A1412065547042/click"}}
小黃瓜:
When I follow "Profile"
And I follow "Edit"
HTML:
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Profile <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Show</a></li>
<li><a href="#">Edit</a></li>
</ul>
</li>
</ul>
您可以在頁面上運行所示的XPath表達式,以查看它是否真的是唯一一次使用「Profile」並且選擇了正確的元素。輸入開發者工具控制檯:'$ x(「(// html /.// a [./@ hr ........」);' – 2014-09-30 08:55:41