Элемент Selenium python не активируется - WebDriverWait - PullRequest
0 голосов
/ 02 мая 2020

Попытка нажать кнопку после открытия всплывающего окна на странице HTML с использованием Selenium в python. Вот мой код:

driver.find_element_by_id("location").click()
element = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,"//button[@id='sortbydistbtn']")))
element.click()

Ниже приведен код для HTML code:

<div class="b-modal __b-popup1__" style="background-color: rgb(0, 0, 0); position: fixed; inset: 0px; opacity: 0.8; z-index: 9998; cursor: pointer;"></div>
<section class="jpop dn" id="jsbd" style="left: 371px; position: absolute; top: 105.625px; z-index: 9999; opacity: 1; display: block;"> 
    <section class="jpbg">
        <span class="jcl">X</span>
        <span class="ptxt">Sort By Location</span>
        <p>Where in Delhi</p>
        <span class="jinp">
            <input class="" type="text" name="sortbydist" id="sortbydist" value="110001" autocomplete="off">
            <input type="hidden" name="locarea" id="locarea" value="">
            <span id="sbd" class="jauto dn"></span>
        </span>
        <!--<button class="jbtn" type="button" onClick="return sortBydist('10364355');">Go</button>-->
        <button class="jbtn" id="sortbydistbtn" type="button" data-catid="10364355">Go</button>
    </section>
</section>

Код HTML открывается как всплывающее окно, когда location щелкнул в первой строке python. Всплывающее окно открывается в автоматическом окне chrome, но после этого ничего не происходит. Я должен выполнить, нажмите на кнопку.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...