You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the examples it says :
"The URL that Chrome is listening on is displayed in the terminal after Chrome starts up."
This works fine, but how to do handle all this programmatically ? Copy-pasting an url is not possible in production.
Have you a way to get this url automatically ? Isn't there a way to bypass this ? I mean, other library like Pychrome (outdated), were simply asking for the url 'pychrome.Browser(url="http://127.0.0.1:9222")'
In python, Selenium is allowing : driver.execute_cdp_cmd('Target.getTargets', {}). Those libraries are not as complete as trio-chrome, but I do not need to copy paste an url by hand.
The text was updated successfully, but these errors were encountered:
benoitgaly
changed the title
How to launch trio-chrome programmatically ?
How to launch trio-chrome fully programmatically ?
May 23, 2020
Best I have found so far with Selenium is : chrome_options.add_argument(f'--remote-debugging-port={self.dev_tools_port}')
#chrome_options.add_argument("--user-data-dir=C:\Applications\profile")
chrome = webdriver.Chrome(executable_path=self.driver_exe, chrome_options=chrome_options, service_log_path=os.devnull)
chrome.get(f'http://127.0.0.1:{self.dev_tools_port}/json/version')
pre = chrome.find_element_by_tag_name("pre").text
data = json.loads(pre)
self.webSocketDebuggerUrl = data['webSocketDebuggerUrl']
In our own use case, we create the browser in a separate component and pass the URL into Trio CDP, but as you point out many libraries have this feature and it would be good to add it here. I will leave this ticket open as a reminder.
In the meantime, here is some sample code for getting the chrome URL programmatically:
importasksport=9000url="http://localhost:{}/json/version".format(port)
response=awaitasks.get(url)
data=response.json()
debugger_url=data["webSocketDebuggerUrl"]
# Now `debugger_url` can be passed into Trio CDP
Hi,
In the examples it says :
"The URL that Chrome is listening on is displayed in the terminal after Chrome starts up."
This works fine, but how to do handle all this programmatically ? Copy-pasting an url is not possible in production.
Have you a way to get this url automatically ? Isn't there a way to bypass this ? I mean, other library like Pychrome (outdated), were simply asking for the url 'pychrome.Browser(url="http://127.0.0.1:9222")'
In python, Selenium is allowing : driver.execute_cdp_cmd('Target.getTargets', {}). Those libraries are not as complete as trio-chrome, but I do not need to copy paste an url by hand.
The text was updated successfully, but these errors were encountered: