私のクエリで誰かが私を助けてくれることを望んでいます。私はオンラインでかなりの研究をしてきましたが、まだそれに特有の解決策は見つかりませんでした。テスト実行中にランダムなHTMLポップアップを停止/処理する方法 - Selenium Webdriver
テストケースを実行しているときに、スクリプトで処理できないHTMLポップアップが表示されることがあります。それは非常にランダムであり(サイトを横切っている間の顧客の行動に基づいている)、顧客の旅行中いつでもポップアップすることができます。時にはポップアップしないこともあります。表示されるときは、DOM内にエントリが表示されます。
基本的には、希望する場合にエージェントが注文を完了するのに役立つことを顧客に示すライブチャットウィンドウ(正確にはLivePerson)です。ここで
はスクリーンショットです:以下
私は要素を検査する際のFirebugで提供されています:
<div id="LPMcontainer-1483053256847-0" class="LPMcontainer LPMoverlay" style="margin: -143px 0px 0px -285px; padding: 0px; border-style: solid; border-width: 0px; outline-color: rgb(106, 159, 177); outline-width: 2px; font-style: normal; font-weight: normal; font-variant: normal; list-style: outside none none; letter-spacing: normal; line-height: normal; text-decoration: none; vertical-align: baseline; white-space: normal; word-spacing: normal; background-repeat: repeat-x; background-position: left bottom; background-color: transparent; border-color: transparent; width: 571px; height: 287px; cursor: pointer; display: block; z-index: 107158; position: fixed; top: 50%; bottom: auto; left: 50%; right: auto;">
<div role="button" tabindex="0"><img src="https://www./content/dam/tcom/apps/live-person/live-person-chat-bundles-top.jpg" id="LPMimage-1483053256849-2" alt="" class="LPMimage" style="margin: 0px; padding: 0px; border-style: none; border-width: 0px; outline-color: rgb(106, 159, 177); outline-width: 2px; font-style: normal; font-weight: normal; font-variant: normal; list-style: outside none none; letter-spacing: normal; line-height: normal; text-decoration: none; vertical-align: baseline; white-space: normal; word-spacing: normal; position: absolute; z-index: 600; left: 0px; top: 0px;">
</div>
<img src="https://www./content/dam/tcom/apps/live-person/live-person-chat-bottom.jpg" id="LPMcloseButton-1483053256847-1" alt="" class="LPMcloseButton" style="margin: 0px; padding: 0px; border-style: none; border-width: 0px; outline-color: rgb(106, 159, 177); outline-width: 2px; font-style: normal; font-weight: normal; font-variant: normal; list-style: outside none none; letter-spacing: normal; line-height: normal; text-decoration: none; vertical-align: baseline; white-space: normal; word-spacing: normal; position: absolute; cursor: pointer; z-index: 9999; left: 0px; top: 194px;" data-lp-event="close" role="button" tabindex="0">
</div>
それはすべてのブラウザに表示されます。
私は、次のいずれかの方法でそれを処理したいと思います:
- は(原因ランダムな性質のために再び)すべてのロードから、それを停止します。 OR
- スクリプトが実行されている間に、ウィンドウが表示されるとすぐに、「No thanks」ボタン(上記のコードではid = "LPMcloseButton-1483053256847-1")を押して、残りのステップを実行し続けます。 IDは本質的に動的なIDです。つまり、毎回ユニークです。
ご協力いただきますようお願い申し上げます。
ありがとうJeff。それは知っているととても便利です。私はあなたが提案した方法を試みます。私の直感は、これが私の場合でもうまくいくかもしれないと言っています:-) – SDN