2

我是 Selenium IDE 的新手,需要 assertText 一个具有换行符的值。例子:

assertText 的实际消息:
Hello
World

store      | Hello <br/> World | txtValue
assertText | id=label          | ${txtValue}

请帮忙。

4

2 回答 2

2

将您的变量传递id=label给变量,删除换行符,然后对变量运行断言。

  1. 存储预期文本:

    store | Hello World | txtValue
    
  2. 存储页面文本:

    storeText | xpath=(//*[@id=label]) | labelValue
    
  3. 从页面文本中删除换行符:

    echo  | javascript{storedVars.labelValue = storedVars.labelValue.replace(/(\r\n|\n|\r)/gm,"")} | 
    
  4. 断言您的预期文本=您的页面文本:

    assertExpression | javascript{storedVars.txtValue==storedVars.labelValue} | true
    
于 2012-09-27T03:49:36.427 回答
-1

以下模式匹配对我有用Selenium IDE 2.5.0

regexp:Hello\s+World
于 2014-03-26T02:58:23.310 回答