SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.42k stars 8.15k forks source link

[🐛 Bug]: Failure to receive the log of the network section from another tab #14063

Closed majidys closed 2 months ago

majidys commented 4 months ago

What happened?

To test a web application, I need to open this application in two tabs. I want to compare the network log sent in the first tab and the network log received in the second tab. But when I use the browser.get_log('performance') command to get the network section log of the second tab, invalid values ​​are returned !

Meanwhile, if I open two separate browsers and use this command to receive the log, the sent and received values ​​are similar and the test result works correctly.

How can we reproduce the issue?

for indx in range(2):
        print('\n', colored(
            f" Operator {indx+1} : ", 'black', 'on_light_yellow', ['bold']), '\n')

        # 1 : May be in another tab because of another test so we have to go back to the first Tab
        browser.switch_to.window(tabs[indx])
        if indx==0 :
            # Open boarder and Draw a line
            try:
                ....

        network = browser.get_log('performance')
        for itm in network:
            Msg = itm['message']
            if "object-added" in Msg and "push" in Msg:
                if indx==0 :
                    drawnـdesigns.append(Msg)
                else :
                    designs_seen.append(Msg)

if drawnـdesigns==designs_seen :
        print(f"✅ 🎯 {doneFormat(f' The drawn shape (⬜) was ➡️sent and ⬅️received 👌 ')}")

Relevant log output

--

Operating System

win 10

Selenium version

4.20

What are the browser(s) and version(s) where you see this issue?

chrome 125.0.6422.141

What are the browser driver(s) and version(s) where you see this issue?

last

Are you using Selenium Grid?

-

github-actions[bot] commented 4 months ago

@majidys, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

titusfortner commented 4 months ago

I'm not looking at the code, but our browser logging implementations are not consistent right now, and we need to deprecate them when we move to bidi implementations. I'm pretty sure this method is just grabbing what chromedriver has collected, and I'm not sure how Google is managing browsing contexts within the driver. It'll need to be more explicit by the user in the future.

diemol commented 2 months ago

I am closing this due to the lack of activity.

github-actions[bot] commented 1 month ago

This issue has been automatically locked since there has not been any recent activity since it was closed. Please open a new issue for related bugs.