[英]How can i find the cssselector for the following error message
我正在使用Selenium Web驅動程序測試注冊流程。 我有一個字段要輸入電子郵件ID,該ID不應與用戶的emailId(已注冊的用戶)相同。 該代碼在下面提到。 我需要獲取cssselector。
<em for="coworkeremail" class="error">Your co-worker's email must be different than yours</em>
謝謝Java初學者
在該課程上進行匹配有點粗略,特別是如果還有更多。 error
是一個非常通用的類,所以我會說在for
屬性上匹配。
em.error[for='coworkeremail']
正如您在評論中所說,您的元素在框架中。 找到該框架的ID或名稱,然后執行,
driver.switchTo().frame("idOrName"); // assuming you are using Selenium 2 and Java
然后找到元素。
僅考慮class = error
一個元素
.error
是CSS選擇器。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.