簡體   English   中英

我如何找到以下錯誤消息的cssselector

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM