Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serenity Devtools driver issue #2925

Closed
Vijay2871 opened this issue Sep 16, 2022 · 7 comments
Closed

Serenity Devtools driver issue #2925

Vijay2871 opened this issue Sep 16, 2022 · 7 comments

Comments

@Vijay2871
Copy link

When i try to extract info from console using devtools I'm getting issue in driver showing null
code snippet:
image

Error:Step failed
java.lang.NullPointerException: Cannot invoke "org.openqa.selenium.devtools.DevTools.createSession()" because "this.devTools" is null

image

@globalworming
Copy link
Collaborator

you are just declaring Devtools devtools;, they are just null. you have to get devtools from the webdriver like here

though in step libraries you don't get the webdriver, do you?

@oleksandr-kobzan-philips
Copy link

oleksandr-kobzan-philips commented Oct 5, 2022

hi @globalworming,
I have the same result running tests on docker-selenium 4.5.0-20221004 version.
Browser: chrome
Serenity-core: 3.3.4 version

BrowseTheWeb.as(actor).getDevTools() is returned null.

@wakaleo
Copy link
Member

wakaleo commented Oct 22, 2022

getDevTools() will return null if the driver does not support the HasDevTools interface - are you sure the driver you are using supports dev tools?

@oleksandr-kobzan-philips

Hi @wakaleo,
It doesn't work on serenity core 3.3.4,3.3.5, but works on 3.2.5
Our configuration is:

Works when run on local driver for all versions
-Dwebdriver.chrome.driver=/home/user/Downloads/chromedriver

@wakaleo
Copy link
Member

wakaleo commented Oct 24, 2022

Cool, so this can be closed?

@oleksandr-kobzan-philips

please don't close it because the issue with RemoteWebDriver still exists.

@wakaleo
Copy link
Member

wakaleo commented Oct 26, 2022

This isn't a Serenity issue. The RemoteWebDriver class does not implement the HasDevTools interface, and so cannot provide a DevTools object. The DevTools support works correctly for drivers that implement HasDevTools, e.g.

        BrowseTheWeb.as(actor).maybeGetDevTools().ifPresent(
                devTools -> {
                    devTools.createSession();
                    devTools.send(Log.enable());
                    devTools.addListener(Log.entryAdded(), logEntry -> {
                        System.out.printf("DEVTOOLS LOG: %s\n - %s: %s",logEntry.getLevel(), logEntry.getUrl(), logEntry.getText());
                    });
                }
        );

@wakaleo wakaleo closed this as completed Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants