1
Pythonで特定のページにアクセスするために、セレニウムを使用してスクリプトを作成しました。そこに到達するには5つのステップがあります。最初に私のブラウザは「アドレスで検索」ボタンをクリックし、ボックスに「ストリート名」と対応するボックスに「ストリートアドレス」と入力し、検索ボタンをクリックしてターゲットページに移動する必要があります。しかし、「アドレスで検索」ボタンをクリックしている間、最初の試みでエラーが発生します。それに応じて私はそれをしたようだが、私は間違いを犯しているのか分からない。それを調べるために事前に感謝します。 私がしようとしているスクリプト:「アドレスで検索」のボタンは、IDが発見され、その中Pythonセレニウムがボタンをクリックできない
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Chrome()
driver.get("http://hcad.org/quick-search/")
wait = WebDriverWait(driver, 10)
driver.find_element_by_id("s_addr").click()
driver.find_element_by_name('stnum').send_keys('8227')
driver.find_element_by_name('stname').send_keys('FINDLAY ST')
driver.find_element_by_link_text("Search").click()
driver.quit()
要素:残りのキーワードをボックスに記入する、その中
<tbody><tr>
<td class="auto-style1"></td>
<td width="15" align="left" valign="top" class="auto-style1"></td>
<td width="600" align="left" valign="top" class="auto-style1">
<input type="submit" id="s_acct" value="Search By Account">
<input type="submit" id="s_addr" value="Search By Address">
<input type="submit" id="s_name" value="Search By Owner Name"><table>
<form id="search_button" name="search_button" action="/records/QuickSearch.asp" method="post"></form>
要素を:
<tr align="middle">
<td colspan="1">
<select name="TaxYear">
<option value="2017">2017</option>
</select></td>
<td align="middle">
<input name="stnum" size="5" maxlength="5"></td>
<td align="middle">
<input name="stname" maxlength="24">
</td><td align="middle">
<nobr><input type="submit" value="Search"></nobr>
</td>
</tr>
エラー私は取得しています:
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element:
ありがとうございますOluwafemi Sule、あなたの効果的な答えです。私はしばらくの間、iframeを忘れてしまった。それはトリックでした。 – SIM