neliCZka
neliCZka

Reputation: 945

Robot framework - how to work with developer tools in chrome during test run?

Is there any possibility to leave dev tools (inspector) opened during a robot test run? I included a manual step into my "semi-automated" test in which I open the dev tools (F12), but after click on PASS for the Execute Manual Step other automated steps follow and the dev tool is immediately automatically closed. Just overview of the structure of my test:

Semi-automated robot test
    do some automated steps
    execute manual step     open developers console
    do some other automated steps
    execute manual step     check something in dev console

I have no idea how to handle the dev tools during robot test. Even if I open the dev tool in separate window during the manual step, it is still closed during automated steps...

Thanks for any idea :-)

Upvotes: 2

Views: 3730

Answers (3)

A. Kootstra
A. Kootstra

Reputation: 6961

As an example to the answer of @Guy you can use the Dialogs library in Robot Framework

*** Settings ***
Library    Dialogs

*** Test Cases ***
test case
   Pause Execution    Please Press OK to Continue. 

This will then show you the following alert type of box.

enter image description here

Upvotes: 2

Andersson
Andersson

Reputation: 52665

If you just want to get information about HTTP-requests that were sent during your Seelenium test-run you might need to add below code, that will constantly print out logs with required info:

import logging
import http.client as client

client.HTTPConnection.debuglevel = 1
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("selenium.webdriver.remote.remote_connection")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True

Upvotes: 1

Guy
Guy

Reputation: 50809

It isn't possible. From ChromeDriver help center

When you open the DevTools window, ChromeDriver is automatically disconnected. When ChromeDriver receives a command, if disconnected, it will attempt to close the DevTools window and reconnect.

If you need to inspect something in DevTools, the best you can do now is pause your test so that ChromeDriver won't close DevTools. When you are done inspecting things in Chrome, you can unpause your test and ChromeDriver will close the window and continue.

Upvotes: 4

Related Questions