-
Notifications
You must be signed in to change notification settings - Fork 112
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
How to get Tab's attributes? #69
Comments
I had the same question. It seems one way to do it is to send a request to the browser that is ran with --remote-debugging-port=9222. Send a GET request to localhost:9222/json after the browser is launched with the flag, and you will get a response that includes the titles/urls of the tabs. I think this ability should be included in this library. I want to execute some javascript in an opened tab based on a regex match of the tabs title. And so I need to know the titles of the tabs to accomplish this use case. I guess for now I will need to use the CDP REST API manually for my usage at the moment. |
I concur with your perspective. My current approach involves establishing connections to each tab and retrieving attributes through network requests. However, my objective is to interact exclusively with the tab that has the URL www.google.com. The current method necessitates the opening of every tab, which is proving to be quite inefficient and time-consuming. I am seeking a more streamlined solution that would allow me to interact with the specific tab without the overhead of opening all tabs. Is there a way to refine this process to target and manipulate the desired tab directly? My code like this for tab in tabs:
tab.start()
tab.Network.enable()
tab.DOM.enable()
document = dom.getDocument()
root_node_id = document.get('root', {}).get('nodeId') # get everything about tab |
I've just discovered that these attributes are functional. However, how can I retrieve other tab attributes such as the title and URL?
The text was updated successfully, but these errors were encountered: