1
我有一個具體的問題,因爲我無法弄清楚如何提交沒有「id」或「name」在selenium.webdriver(phantomjs)中有html logim形式:ASP.Net MVC 4與PhantomJS和硒的C#登錄表格
<div class="ui-helper-child-2 ui-page-column-last ui-page-column-span-12">
<div class="ui-page-column-block ui-widget-signin">
<h1>Sign In</h1>
<form action="/glo/en-us/session,create/view.html" method="post">
<div class="ui-helper-child-1">
<label class="ui-state-required" for="username">Customer ID:</label>
<input id="username" name="username" maxlength="9" type="text" value="" />
</div>
<div class="ui-helper-child-2">
<label class="ui-state-required" for="password">Password:</label>
<input id="password" name="password" maxlength="20" type="password" value="" />
</div>
<div class="ui-helper-child-3">
<label class="ui-state-required" for="companyId">Company:</label>
<select id="companyId" name="companyId">
<option selected="selected" value="glo">Choose company</option>
<option value="asp">new to asp</option>
<option value="aeg">who is it</option>
<option value="asus">who use this brand name</option>
</select>
</div>
<div class="ui-helper-child-4">
<input id="callback" name="callback" type="hidden" value="/glo/en-us/home,show/view.html?error=1" />
<input type="submit" value="Sign In" />
</div>
</form>
</div>
和一次如何登錄?我可以通過webdriver.FindElement(用戶名)等添加信息,但不知道如何發佈數據,因爲我沒有提交元素中的id或名稱。
是它的工作原理。謝謝。看起來我太懶惰,找不到元素。 – Dovydas