Skip to content

Execute_(async_)script JS input not available in debugger/sources tab. #2162

@chrisdt1998

Description

@chrisdt1998

I am using the selenium webdriver for Firefox for a project and I noticed that when I use execute_script, and I have a debugger statement in the JavaScript code that I pass through to it, the breakpoint is never 'activated', meaning the code never pauses at the debugger statement. This made me notice that the JS code is not available in the debugger/sources tab which I think is the source of the issue.

Note that I also tried this in chrome and it works as expected: The code pauses at the debugger statement (you need to have the terminal open) and then the JS code that you passed through execute_script is available in the debugger/sources tab.

It would be really useful to have the both the code available in the debugger sources tab and for the breakpoints to work. Another advantage of this is that we can see exactly where in the JS code an error is if one occurs. Please let me know if you'd like me to provide screenshots of how it works in Chrome.

System

  • Version: 0.34.0
  • Platform: Linux
  • Firefox:
  • Selenium: 4.18.1

Steps to reproduce:

Run the following code, the browser should pause at the breakpoint but you will notice that it doesn't.

from selenium import webdriver
import time
driver = webdriver.Firefox()
time.sleep(5)
driver.get('https://www.plex.tv/')
driver.execute_script('console.log("Hello, World!"); debugger; console.log("Hello, World! AGAIN!");')

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions