0

我正在尝试登录以下网站。但是,我确实很挣扎,因为我认为我必须首先单击“登录”按钮才能访问表单。有人可以帮忙吗?

from robobrowser import RoboBrowser
browser = RoboBrowser()
login_url = 'https://coin.fyi/'
browser.open(login_url)
form = browser.get_form(id='login-form')
form['Username or email'].value = 'myusername'
form['Password'].value = 'mypassword'
browser.submit_form(form)

出现以下错误:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-58-8c90b79a2ae6> in <module>()
----> 1 form['Username or email'].value = "xxx"

TypeError: 'NoneType' object is not subscriptable

此外,我收到以下警告:

C:\Anaconda3\lib\site-packages\bs4\__init__.py:181: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.

The code that caused this warning is on line 193 of the file C:\Anaconda3\lib\runpy.py. To get rid of this warning, change code that looks like this:

 BeautifulSoup(YOUR_MARKUP})

to this:

 BeautifulSoup(YOUR_MARKUP, "lxml")

  markup_type=markup_type))

干杯

4

0 回答 0