点击输入按钮

时间:2019-05-20 15:30:34

标签: python python-3.x selenium selenium-webdriver

我需要让Selenium Script单击网站上的输入按钮。由于某些原因,我尝试过的所有方法均无效。看起来很简单,但对我来说却不容易。

错误:

    backupbidbutton.click()
TypeError: 'NoneType' object is not callable

按钮html代码:

<input type="submit" value="Place Backup Bid" class="bid-button place-backupbid-button" rel="placeBestBid" id="placeBackupBidButton">

我的代码:这就是我要求按钮单击的方式。

    backupbidbutton = soup(browser.page_source, 'html.parser').find('input', {'id':'placeBackupBidButton'})
    backupbidbutton.click()

我用BeautifulSoup要求它。

1 个答案:

答案 0 :(得分:1)

为什么不使用id而不是汤,而是尝试从页面源中获取元素。

代码:

input_button =  driver.find_element_by_id("placeBackupBidButton")
input_button.click()

确保此输入不应出现在任何帧中。