<bdo id='ucuU1'></bdo><ul id='ucuU1'></ul>

      <small id='ucuU1'></small><noframes id='ucuU1'>

    1. <legend id='ucuU1'><style id='ucuU1'><dir id='ucuU1'><q id='ucuU1'></q></dir></style></legend>
      <i id='ucuU1'><tr id='ucuU1'><dt id='ucuU1'><q id='ucuU1'><span id='ucuU1'><b id='ucuU1'><form id='ucuU1'><ins id='ucuU1'></ins><ul id='ucuU1'></ul><sub id='ucuU1'></sub></form><legend id='ucuU1'></legend><bdo id='ucuU1'><pre id='ucuU1'><center id='ucuU1'></center></pre></bdo></b><th id='ucuU1'></th></span></q></dt></tr></i><div id='ucuU1'><tfoot id='ucuU1'></tfoot><dl id='ucuU1'><fieldset id='ucuU1'></fieldset></dl></div>

      <tfoot id='ucuU1'></tfoot>

    2. 如何使用 Python + Selenium 从警报框中读取文本

      时间:2023-07-05
      <legend id='F57g9'><style id='F57g9'><dir id='F57g9'><q id='F57g9'></q></dir></style></legend>

      <small id='F57g9'></small><noframes id='F57g9'>

      <tfoot id='F57g9'></tfoot>
    3. <i id='F57g9'><tr id='F57g9'><dt id='F57g9'><q id='F57g9'><span id='F57g9'><b id='F57g9'><form id='F57g9'><ins id='F57g9'></ins><ul id='F57g9'></ul><sub id='F57g9'></sub></form><legend id='F57g9'></legend><bdo id='F57g9'><pre id='F57g9'><center id='F57g9'></center></pre></bdo></b><th id='F57g9'></th></span></q></dt></tr></i><div id='F57g9'><tfoot id='F57g9'></tfoot><dl id='F57g9'><fieldset id='F57g9'></fieldset></dl></div>

                <bdo id='F57g9'></bdo><ul id='F57g9'></ul>
                  <tbody id='F57g9'></tbody>

                本文介绍了如何使用 Python + Selenium 从警报框中读取文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我想从警告框中读取文本.

                I want to read the text from the alert box.

                如果在警告框中找到此文本,我必须关闭警告框:

                If this text is found in the alert box I have to close the alert box:

                推荐答案

                我的框架中也有类似的情况,我就是这样解决的.

                I have similar situations as this in my framework as well, and this is how I solved it.

                if (_driver.FindElement(By.XPath("//*[text()[contains(.,'No Sales Found')]")).Enabled)
                {
                     //Do Something
                }
                

                把它放在可能导致错误的功能之后.另外,这个例子是用C#和_driver作为驱动,可能和你用的不一样.

                Put this after functionality that may bring the error up. Also, this example is using C# and _driver as the driver, which may be different from what you are using.

                这篇关于如何使用 Python + Selenium 从警报框中读取文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:Webdriver 错误:“不存在警报"在抛出 UnexpectedAlertPresentException 下一篇:Selenium Threads:如何使用代理运行多线程浏览器(python)

                相关文章

                  <tfoot id='fAa2p'></tfoot>

                  <small id='fAa2p'></small><noframes id='fAa2p'>

                1. <legend id='fAa2p'><style id='fAa2p'><dir id='fAa2p'><q id='fAa2p'></q></dir></style></legend>

                      <bdo id='fAa2p'></bdo><ul id='fAa2p'></ul>
                  1. <i id='fAa2p'><tr id='fAa2p'><dt id='fAa2p'><q id='fAa2p'><span id='fAa2p'><b id='fAa2p'><form id='fAa2p'><ins id='fAa2p'></ins><ul id='fAa2p'></ul><sub id='fAa2p'></sub></form><legend id='fAa2p'></legend><bdo id='fAa2p'><pre id='fAa2p'><center id='fAa2p'></center></pre></bdo></b><th id='fAa2p'></th></span></q></dt></tr></i><div id='fAa2p'><tfoot id='fAa2p'></tfoot><dl id='fAa2p'><fieldset id='fAa2p'></fieldset></dl></div>