Closed
Description
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?