Selenium Python没有名称或ID
我如何提交邮政编码。 “ 3000”,然后在我无法按名称或ID搜索时单击提交硒(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()
How do I submit the postcode eg. "3000" and click submit Selenium (Python) when I can't search by the name or ID.
Here is the 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>
Here is what I have tried
# 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()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您需要XPath属性,则可以这样做
If you need an xpath for an attribute you can do it like so