我如何提交郵政編碼,例如。當我無法按名稱或 ID 搜索時,單擊“3000”并單擊提交 Selenium (Python)。
這是HTML
<div class="container-fluid" id="basicpage">
<div class="container">
<div class="row">
<div id=right_col class="col-xs-12 col-md-9">
<div class=nothingwrapper>
</div>
<div class=nothingwrapper>
<h1>Postcode Snapshot </h1>
<p> Please type in the postcode for which you would like to download a postcode snapshot:</p>
<form action="postcodesnapshotchoosepostcode.php" method="post">
<input name=sub value=1 type=hidden>
<p><input type=text name=postcode size=5></p><p><input type=submit value='Continue' /></p>
</form>
<p> </p>
</div>
這是我嘗試過的
# Select the by name
postcode_box = driver.find_element(By.NAME, "postcode")
# Send information
postcode_box.send_keys('3000')
driver.find_element(By.NAME("sub")).submit()
uj5u.com熱心網友回復:
//input[@value='Continue']
如果你需要一個屬性的 xpath,你可以這樣做
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/496224.html
