You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to perform a long key press on a website for about 3 seconds.
Reading the documentation I found self.press_up_arrow(selector="html", times=1, by="css selector") but increasing the times parameter isn't working for me. So, I tried using the following:
from seleniumbase import SB
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
with SB(
#demo=True,
ad_block=True
) as sb:
sb.open("https://my.url")
actions = ActionChains(sb)
actions.key_down(Keys.ARROW_LEFT).pause(3).key_up(Keys.ARROW_LEFT)
actions.perform()
Unfortunately I get the error:
...
File "/some/file.py", line xy, in perform
actions.perform()
~~~~~~~~~~~~~~~^^
File "/.venv/lib/python3.13/site-packages/selenium/webdriver/common/action_chains.py", line 94, in perform
self.w3c_actions.perform()
~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/.venv/lib/python3.13/site-packages/selenium/webdriver/common/actions/action_builder.py", line 170, in perform
self.driver.execute(Command.W3C_ACTIONS, enc)
^^^^^^^^^^^^^^^^^^^
AttributeError: 'BaseCase' object has no attribute 'execute'
What should I try?
The text was updated successfully, but these errors were encountered:
ActionChains expects a driver object, not an sb object.
You should be passing in sb.driver into it, not sb.
(ActionChains is from the selenium library, not the seleniumbase one.)
I need to perform a long key press on a website for about 3 seconds.
Reading the documentation I found
self.press_up_arrow(selector="html", times=1, by="css selector")
but increasing the times parameter isn't working for me. So, I tried using the following:Unfortunately I get the error:
What should I try?
The text was updated successfully, but these errors were encountered: