-
Notifications
You must be signed in to change notification settings - Fork 1.4k
-
Hey Michael,
I'm used to running python in interactive mode so that I can select elements quickly without having to re-run my script. This lets me confirm i've selected the element I'm looking for on the webpage and run commands on the go. I've tried running my script with python -i script.py and it works but the driver closes automatically. This leads me to my next question. How do I prevent the window from closing after executing the script. In selenium, this is done by options.add_experimental_option('detach', True) - what is the equivalent in SeleniumBase?
I'm currently using the SB syntax and my code is as follows:
with SB(uc=True) as sb:
url = "https://www.bet365.com.au/"
sb.activate_cdp_mode(url)
sb.cdp.click_link('Log In')
Thanks
Beta Was this translation helpful? Give feedback.
All reactions
Duplicate of #1814 (comment).
Use a breakpoint to keep the browser window open:
breakpoint()
Breakpoint common controls: n
= next, c
= continue, s
= step.
When you're done with the browser window, use c
and hit Enter so that SeleniumBase can safely close the browser and terminate used resources such as drivers.
Replies: 1 comment 2 replies
-
Duplicate of #1814 (comment).
Use a breakpoint to keep the browser window open:
breakpoint()
Breakpoint common controls: n
= next, c
= continue, s
= step.
When you're done with the browser window, use c
and hit Enter so that SeleniumBase can safely close the browser and terminate used resources such as drivers.
Beta Was this translation helpful? Give feedback.
All reactions
-
Hey Michael,
Breakpoint() only pauses the script. It does not allow you to continue to use SB methods to interact with the webpage.
Beta Was this translation helpful? Give feedback.
All reactions
-
Actually, it does. breakpoint()
pauses script execution, giving you an interactive Python prompt via the breakpoint that keeps the browser open.
Beta Was this translation helpful? Give feedback.