html - 如何在 python 中知道 Web 表单 ID/名称,填写 Web 表单并返回数据
问题描述
我目前正在尝试将信息自动提交到该网站上的网络表单中:https ://coinomi.com/recovery-phrase-tool.html不幸的是我不知道表单的名称,似乎无法从中找到源代码。现在我尝试使用 requests python 模块填写表单,并且在抓取之前通过 URL 传递参数。不幸的是,我找不到表格的名称,所以我不能这样做。
如果可能的话,我想在https://github.com/Coinomi/bip39/blob/master/bip39-standalone.html使用网站的离线版本来做到这一点,这样它更安全,但我几乎不知道如何使用常规使用我拥有的工具创建 Web 表单,更不用说从我的计算机本地访问了。
解决方案
我不确定您到底在寻找什么。但是,这是代码的一部分,selenium
用于填写您提到的表单的某些部分。
import selenium
from selenium import webdriver
from selenium.webdriver.support.select import Select
browser = browser = webdriver.Chrome('C:\\Users...\\chromedriver.exe')
browser.get('https://coinomi.com/recovery-phrase-tool.html')
# Example to fill a text box
recoveryPhrase = browser.find_element_by_id('phrase')
recoveryPhrase.send_keys('your answer')
# Example to select a element
numberOfWords = Select(browser.find_element_by_id('strength'))
numberOfWords.select_by_visible_text('24')
# Example to click a button
generateRandomMnemonic = browser.find_element_by_xpath('/html/body/div[1]/div[1]/div/form/div[4]/div/div/span/button')
generateRandomMnemonic.click()
推荐阅读
- c# - 多个列表或字典?
- android - infowindow位置第一次不正确
- asp.net - 如何检查最大用户可以参加比赛 - 并发请求
- python - 由于错误,无法将 .py 文件转换为 .exe
- vim - 如何在左侧打开 NERDTree?
- unix - 有没有办法打开我在同一管道中过滤掉的文件并根据内容再次过滤它们?
- python - 如何在每个月的 10 日在表中添加缺失的行?
- google-apps-script - Google 表格的触发器
- c++ - 为什么在获取网站源代码时会得到特殊字符?C++
- machine-learning - 如何处理机器学习中特定记录中的多个特征值?