查找错误,而试图登录instagram使用氦/硒



所以我试图登录使用氦气包,它在引子下使用硒,

我查看了它的文档,但我得到一个查找错误。有谁能帮帮忙吗?

这里是github: Helium Cheatsheet

下面是我的代码:
from helium import*
import time
start_firefox("https://www.instagram.com/")
time.sleep(5)
write('user@gmail.com', into= 'username')
write('awesome', into= 'Password')
press(ENTER)
kill_browser()

这里的用户名和密码是假的:)

这里是完整的错误,我得到在jupyter笔记本。它可以很好地加载浏览器和instagram页面,但当然我无法登录:(

LookupError                               Traceback (most recent call last)
<ipython-input-3-ebfcb487680f> in <module>
3 time.sleep(5)
4 
----> 5 write('user@gmail.com', into= 'username')
6 write('awesome', into= 'Password')
7 
~AppDataRoamingPythonPython39site-packageshelium__init__.py in write(text, into)
171                 write("Michael", into=Alert("Please enter your name"))
172     """
--> 173         _get_api_impl().write_impl(text, into)
174 
175 def press(key):
~AppDataRoamingPythonPython39site-packageshelium_impl__init__.py in f_decorated(self, *args, **kwargs)
35                         return f(self, *args, **kwargs)
36                 window_handles_before = driver.window_handles[:]
---> 37                 result = f(self, *args, **kwargs)
38                 # As above, don't access .window_handles in IE if an alert is present:
39                 if not (driver.is_ie() and AlertImpl(driver).exists()):
~AppDataRoamingPythonPython39site-packageshelium_impl__init__.py in f_decorated(*args, **kwargs)
54         def f_decorated(*args, **kwargs):
55                 try:
---> 56                         return f(*args, **kwargs)
57                 except UnexpectedAlertPresentException:
58             raise UnexpectedAlertPresentException(
~AppDataRoamingPythonPython39site-packageshelium_impl__init__.py in write_impl(self, text, into)
159                         if isinstance(into, GUIElement):
160                                 into = into._impl
--> 161         self._handle_alerts(
162                         self._write_no_alert, self._write_with_alert, text, into=into
163         )
~AppDataRoamingPythonPython39site-packageshelium_impl__init__.py in _handle_alerts(self, no_alert, with_alert, *args, **kwargs)
184                 driver = self.require_driver()
185                 if not AlertImpl(driver).exists():
--> 186                         return no_alert(*args, **kwargs)
187                 return with_alert(*args, **kwargs)
188         @might_spawn_window
~AppDataRoamingPythonPython39site-packageshelium_impl__init__.py in _write_no_alert(self, text, into)
170                                         elt.clear()
171                                 elt.send_keys(text)
--> 172                         self._manipulate(into, _write)
173                 else:
174                         self.require_driver().switch_to.active_element.send_keys(text)
~AppDataRoamingPythonPython39site-packageshelium_impl__init__.py in _manipulate(self, gui_or_web_elt, action)
290                 if hasattr(gui_or_web_elt, 'perform') 
291                         and callable(gui_or_web_elt.perform):
--> 292                         driver.last_manipulated_element = gui_or_web_elt.perform(action)
293                 else:
294                         if isinstance(gui_or_web_elt, WebElement):
~AppDataRoamingPythonPython39site-packageshelium_impl__init__.py in perform(self, action)
637                 if result is not None:
638                         return result
--> 639                 raise LookupError()
640         def _perform_no_wait(self, action):
641                 for bound_gui_elt_impl in self.find_all():
LookupError:
from helium import*
import time
start_firefox("https://www.instagram.com/")
time.sleep(5)
if Text('Accept cookies').exists():
click('Accept')
write('user@gmail.com', into='Phone number, username, or email')
write('awesome', into='Password')
press(ENTER)
kill_browser()

进入使用,area-label。你必须给正确的区域标签或使用css选择器S('@Username')

最新更新