何あなたが尋ねるするRun Keyword And Return Status
呼び出しの組み合わせで行うことができます。
${el1 present}= Run Keyword And Return Status Page Should Contains Element //some xpath1
${el2 present}= Run Keyword And Return Status Page Should Contains Element //some xpath2
${el3 present}= Run Keyword And Return Status Page Should Contains Element //some xpath3
${el4 present}= Run Keyword And Return Status Page Should Contains Element //some xpath4
Run Keyword If not ${el1 present} or not ${el2 present} or not ${el3 present} or not ${el4 present} Fail None of the elements is present on the page
この方法は簡単ですが、それは最適ではない - それは最初が存在することができるにもかかわらず、すべての要素をチェックし、第二、第三及び第四のためにチェックする必要はありません。それはRun Keyword If
と呼ばれるキーワードの値を返すことを利用し
${some element present}= Run Keyword And Return Status Page Should Contains Element //some xpath1
${some element present}= Run Keyword If not ${some element present} Run Keyword And Return Status Page Should Contains Element //some xpath2 ELSE Set Variable ${some element present}
${some element present}= Run Keyword If not ${some element present} Run Keyword And Return Status Page Should Contains Element //some xpath3 ELSE Set Variable ${some element present}
${some element present}= Run Keyword If not ${some element present} Run Keyword And Return Status Page Should Contains Element //some xpath4 ELSE Set Variable ${some element present}
Run Keyword If not ${some element present} Fail None of the elements is present on the page
:この(非常にexpresive)のバージョンがあることでしょう。
要約すると、すべての条件(Page Should Contain Element
)をチェックする必要がある場合(この例ではand
に接続されている対応する論理条件で、or
ではなく)をチェックする必要があります。
2番目の場合は1つで十分で、残りのものが真であると判断された場合は残りの部分をチェックしないでください。
あなたの助けombre42 @ありがとうございました:) 私は再びあなたの答えから おかげで、私の質問のための代替ソリューションを見つけました:) – Umesh
私が探していて、あなたがここにあなたのソリューションを投稿場合、それは偉大だったでしょう@Umesh – Shnigi
@ Shnigi私は、オンラインか、オフラインか、離れているか、ビジーであるかをユーザの状態をチェックしたいと思っていました。しかし、後で、私は "Get Xpath Count"を使ってステータスと共にユーザーの数を表示しました。 $ {USERS_ONLINE}一致するXpathを取得する// div [@ class = 'participants-list'] // span [$ {USERS_ONLINE}のユーザーをログに記録する $ {USERS_OFFLINE}一致するXpathを取得する// div [@ class = 'participants-list'] // span [@ class = 'status unavailable] '] $ {USERS_OFFLINE}人のユーザーをオフラインでログに記録する – Umesh