

The Console is a good place to try out the function. For example, suppose you just learned about the built-in JavaScript Array method map(), and you want to experiment with it.
#Chrome iconsole window code
You can use the Console to try out new code that's not related to the page. When you run JavaScript you don't have to interact with the page.
#Chrome iconsole window full
See Console Utilities API Reference to see the full list of utility functions. Running debug(hideModal) pauses your code on the first line of hideModal the next time that it's called. For example, suppose that your JavaScript contains a function called hideModal. DevTools has a few convenience functions that make it easier to inspect a page. driver.close() - It closes the the browser window on which the focus is set. Modifying the page from the Console is possible because the Console has full access to the page's window. driver.close() and driver.quit() are two different methods for closing the browser session in Selenium WebDriver. Using the Console to change the page's title. The Console panel next to the DevTools homepage.įigure 3. For example, Figure 2 shows the Console next to the DevTools homepage, and Figure 3 shows that same page after using the Console to change the page's title.įigure 2.

You can run JavaScript in the Console to interact with the page that you're inspecting. The main difference between the methods is how they display the data that you're logging. See the Console API Reference to browse the full list of console methods. See Get Started With Logging Messages to get hands-on experience with logging. Inspecting the values of variables at a certain moment in time.In Internet Explorer, click Run when prompted. The number of dialog boxes presented during installation depends on the browser. Making sure that code is executing in the right order. The initial Launch console action prompts for an installation and will attempt to open the installer.In the command line, type Screenshot, then click Capture. Alternatively, press Ctrl+Shift+P on Windows and Command+Shift+P on Mac. In the top right corner of the pane, click the three dots icon, then click Run Command.
#Chrome iconsole window mac
Web developers log messages for 2 general reasons: Alternatively, you can press Ctrl+Shift+I on Windows or Command+Shift+I on Mac to open the Developer Tools pane. Try to figure out which lines of code caused the browser to log the messages. querySelector ( 'h2' ), 'h2 not found!' ) įigure 1 shows what the Console looks like after loading the page and waiting 3 seconds. For example, suppose that you're in the process of writing the HTML and JavaScript for a page: Ĭonst h1 = document. When the browser executes your JavaScript and sees an expression like that, it knows that it's supposed to log the message to the Console. To log a message, you insert an expression like console.log('Hello, Console!') into your JavaScript. To open the developer console in Google Chrome, open the Chrome Menu in the upper-right-hand corner of the browser window and select More Tools > Developer. Web developers often log messages to the Console to make sure that their JavaScript is working as expected.
