php-webdriver webdriver Chrome dev tools protocol , how can i listen an event of devtools , it doesn't have listen command - selenium

I use php-webdriver for test automation on chrome, I want to listen to a chrome dev tools event, but the php-webdrvier does not a have a listen command, only execute, is there another way to listen to an event? I am interested in tracing.datacollected event specifically
I tried to find another way but I failed

Related

debugging chrome remotely - doesn't open websocket

Im running chrome headless through chromedriver and selenium via python.
I've run into the following issue both on Mac and Linux.
Im starting chrome as follows:
if self.headless:
options.headless = True
options.add_argument("--headless")
if self.debug_port:
logging.info(f"Setting up remote debugging on port {self.debug_port}")
options.add_argument(f"--remote-debugging-port={self.debug_port}")
options.add_argument(f"--remote-debugging-address=0.0.0.0")
If I connect to http://localhost:9222 from another headed instance of chrome I can see the list of sessions and connect to it seamlessly. At which point i have a window opened up with a screencast of the remote session and the dev console.
Here's that successful example:
When I connect to http://192.168.1.194:9222 I get the list of sessions just fine and upon selecting one the dev console opens but it doesn't start the websocket connection to ws://192.168.1.194 so the screencast and remote debugging capabilities are not available.
Here's that failed example:
I've captured har files and uploaded them here if you want to take a look
Using the following steps I was able to debug remotely. However the screencast functionality did not work. Ultimately that's what I needed so this is only a 50% solution in my case.
So, as noted above in the comments, what's blocking remote debugging from working is that the chrome debugger links out to https://chrome-devtools-frontend.appspot.com/..... and passes a value of ws://192.168.1.194 for the websocket parameter. Any browser will inherently block this, based on it being mixed content - i.e: https + ws
What's needed here is to run the chrome dev tools frontend on a http server
and direct your chrome instance to that server instead of the appspot instance.
Solution Steps
1 Install depot_tools (pre-requisite for building)
https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up
2 Checkout the devtools-frontend repo
https://github.com/ChromeDevTools/devtools-frontend/blob/master/docs/workflows.md#checking-out-source
3 Build chrome devtools frontend
https://github.com/ChromeDevTools/devtools-frontend/blob/master/docs/workflows.md#build
4 Start the devtools-frontend http server
https://github.com/ChromeDevTools/devtools-frontend/blob/master/docs/workflows.md#running-in-hosted-mode
5 Run 2 instances of chrome and use one to debug the other
5.1 Start first instance of chrome headless
...with remote debugging enabled. See the python way in the question above or do it from the command line with the same arguments
5.2 Start a second instance of chrome
...using a different user data dir --user-data-dir=<some-path>
5.3 Navigate to http://192.168.1.194:9222
Use whatever the IP address of the first chrome instance is and the port that you chose.
5.4 Create a link to the local dev server
The 2nd instance of chrome will now be showing you links to debug each of the open tabs of the 1st instance. However the links will still to go https://chrome-devtools-frontend.appspot.com/..... You'll need to copy n paste the link you want and replace the hostname with the hostname of the devtools frontend that you started in step 4
Walla!!
If you figure out how to get the screencast working please comment below! 🙏
N.B:
I also tried using the npm run server command in the devtools frontend but for some reason that server didn't work at all ¯\_(ツ)_/¯

react-devtools for react-native

Recently I started developing in react-native. When trying to debug using the react-devtools extension on the browser (Chrome) I only get access to the console, because all the components and elements are the ones displayed in the devtools web-page (http://localhost:8081/debugger-ui/)
So now I am trying using the react-native standalone version but it is "waiting for React to connect.."
and I get a message at the bottom saying "The server is listening on the port 8097".
I don't know much about ports but it looks to me that the application is on one port (8081) whereas the react-devtools is listening to another (8097).
I tried using adb reverse tcp:8097 tcp:8097 before running the react-devtools but it made no difference.
How do I check what port my app is listening to?
How can I make the standalone devtools run?
And if anyone can link me to a good documentation about ports for people with no background it would be very nice as well.
you are on the right track, after assigning port 8097.
Run Command+d to open the development menu and it is automatically detected by react-devtools.

WebRTC peer iceconnectionstatechange and connectionstatechange dont fire "closed" event from Chrome 80

WebRTC iceconnectionstatechange and connectionstatechange dont fire "closed" event in Chrome 80. Does anyone have any workaround to detect the connectionstatechange when peer is closed? It doesnot fire even in plan-b
They don't fire when calling pc.close() anymore. See
https://bugs.chromium.org/p/chromium/issues/detail?id=1023736
If your JS code calls pc.close() you surely have detected that the other side went away somehow.

How to connect to firefox instance with debugger port?

I am trying to do remote debugging on a Firefox instance similarly to how I would do it in Chrome:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222
If I start Chrome with this parameter, I can then inspect pages from another Chrome instance by navigating to localhost:9222
I am trying to do the same with Firefox:
Set "enable browser chrome and add-on debugging toolboxes" and "enable remote debugging" options to true
opened firefox with the following parameter:
"C:\Program Files\Mozilla Firefox\firefox.exe" -start-debugger-server 1234
Despite this, when I navigate to localhost:1234, the following happens:
I get multiple popups, that tell me there is an incoming request to Firefox
Even when I click okay, nothing seems to happen
localhost:1234 gives "refused to connect" error
Firefox has more debug functionality than chrome/chromium and to access those you need to:
Goto about:debugging
( Can be found in GUI under: triple-bar Button[≡] > Web Developer > Remote Debugging )
Enter your host Network Location and click Add
Click on your debugging instance on the right side.
Debug whatever you wanna debug(Tabs, Extensions or Processes etc.)

ClientProtocolException in jmeter

I am new to testing and using the jmeter for the first time. Using these steps I am trying to record the mobile device scripts in jmeter. I have done the following steps:
Open JMeter and right-click the TestPlan>Add >Threads (Users)>Thread Group.
Right-click the Thread group>Add>Logic Controller>Recording Controller.
Right-click the Threads>Add>Listener>View Results Tree.
Add test script recorder by selecting Add>Non-Test Elements>HTTP(S) Test Script Recorder option.
Add ‘8080’ as Port value and click the Start button. This will start the JMeter proxy on localhost.
but when I am checking the server status on browsers (https://localhost:8080), following error comes:
org.apache.http.client.ClientProtocolException: URI does not specify a valid host name: https:////
at org.apache.http.impl.client.AbstractHttpClient.determineTarget(AbstractHttpClient.java:817)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:517)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:331)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1146)
at org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:240)
You shouldn't be opening https://localhost:8080 URL in browser, you need to configure your mobile device to use the machine, where JMeter is running as proxy host and 8080 as a proxy port.
If you want to test the HTTP(S) Test Script Recorder - configure you browser to use localhost as a proxy host and 8080 as a proxy port and open some intranet or Internet page - you should see the requests under the Recording Controller.
You quickly set up JMeter for recording using Templates feature, just choose File -> Templates -> Recording -> Create from JMeter's main menu and you will have JMeter ready for recording in a couple of seconds (default proxy port will be 8888 in this setup)
If you are targeting to record HTTPS traffic on a mobile device you will also need to install JMeter's self-signed certificate onto it. Look for ApacheJMeterTemporaryRootCA.crt file in JMeter's bin folder, send it to yourself via the email, open the email on mobile device and follow your mobile OS dialog to get it installed.
See Load Testing Mobile Apps Made Easy guide for more information on proper recording of mobile devices traffic using JMeter