I am trying to execute a Junit Jar in Jmeter. In the Script, chrome browser is launched and login screen of my website is displayed, where Username and Password is entered and login button is clicked. So when 2 user load is applied, 2 chrome browsers are launched which is as per the script. However, the credentials which is suppose to get enter in the 2nd Browser are overwriting the credentials field of the 1st Browser. So script for 2nd Browser is failing as nothing is getting entered in the login screen.
The scripts run successfully on Eclipse.
Headless browser. I have added the headless browser code in the script. Now the browser aren't getting launched, everything is running in the background, this should have solved the issue. But the issue still persists when putting the load of 2 users.
Most probably the issue is with your code, i.e. according to WebDriver FAQ
WebDriver is not thread-safe. Having said that, if you can serialise access to the underlying driver instance, you can share a reference in more than one thread. This is not advisable. You /can/ on the other hand instantiate one WebDriver instance for each thread.
So I would recommend either double-checking your Java code which is being used and ensure that there are no static functions or fields and WebDriver instances are put into ThreadLocal
An easier solution would be going for WebDriver Sampler which is compatible with JMeter thread model therefore there should be no race conditions.
You can install the WebDriver Sampler using the JMeter Plugins Manager
Related
So I'm trying to programmatically conduct Google Lighthouse audits on several webpages, and I'm running into an issue. After installing Chrome and node/npm/lighthouse on an Amazon Linux 2 EC2 instance, I am able to successfully run LightHouse tests when I initiate a GUI session and run a command from a terminal within the GUI (this launches chrome and conducts the test as usual) but I am unable to do the same thing from the command line. This is the error I get when launching lighthouse.
ChromeLauncher:error [42565:42565:0516/170626.787500:ERROR:brower_main_loop.cc (1386) Unable to open X display.
While there are a couple of other errors, I believe this is the one I should be paying attention to, because when I try to just launch Google Chrome, that is the exact error I get, so I am inclined to believe it is an issue with trying to launch on a display.
I've also tried the "--headless" option when launching chrome and get
[0516/171128.450564:WARNING:headless_browser_main_parts.cc(83)] Cannot create Pref Service with no user data dir. [0516/171128.521499:ERROR:vaapi_wrapper.cc(594)] Could not get a valid VA display [0516/171128.524992:ERROR:gpu_init.cc(426)] Passthrough is not supported, GL is egl
Another user with a similar question decided to use the Google Pagespeeds API, which will not a be a solution for me-- it needs to be done locally.
Because this works fine on a GUI session with the same server, I really think it's just a display rendering issue, but I don't know how to solve this. Maybe "simulating" a display? I've also tried entering export DISPLAY=1:0, which apparently worked for some users and caused me to stop seeing the error, but the functionality was still broken when running the audit.
Any help would be so useful!!
Information found in this stackoverflow question was infinitely helpful. Although I still get a slew of errors when I try to launch the browser, I can successfully run LightHouse and audit the pages I want to without any errors.
What I'm trying to do?
I am trying to write an application based on such schema:
The chrome extension launches an application (.jar file) on my computer
The application launches another application (external, not written by me), I am passing data to it, it displays the window for user, user enters some data to it, and then this app returns the data to the parent app
The parent app processes the child app response and sends it back to the chrome extension
What's wrong?
When the window of the child app is displayed, the chrome extension is disconnected (it happens exactly at the same time). What follows, the result is not going back to the chrome extension.
What works:
If I omit point no. 2 (just mocking the answer from the child app), the result is returned to the chrome extension.
Including all points: the child app returns it's result correctly. The parent app catches it and tries to return it to the chrome extension (not succeeding, the extension is disconnected)
Also tried
I tried to do it using java multithreading (ExecutorCompletionService, Callable, Future), I wanted to launch the child app in a separate thread and block the main thread until the child is finished, it didn't help.
Solved!
The communication between the chrome extension and my app is through the standard input/output. Somewhere in the code of my app (written in java) there was System.out.println called. It made some mess on STDOUT and made the app disconnect from the extension. It happened in the same time with launching the external app as I saw it, probably didn't happen exactly at the same time, but some time before/after, something the person cannot see.
Multithreading has nothing to do with this problem.
Solution
I found and removed all code writing to standard output
I know that chrome devtool could be used as an open debugger frontend, with receiving debug info by a websocket from debugger host and displaying them such as source file and console log, it also supply a flow-control GUI for single step task as long as the host supports.
but according to the ReactNative's remote debug page:
React Native JS code runs as a web worker inside this tab.
it seems that the chrome is not only a frontend but also executes the code being debugged? so my question is:
1.how can the device-dependent code be executed in chrome?
2.will the device also execute code ? if it is, what's the relationship between it and chrome? if not, how does the app run in device?
1.how can the device-dependent code be executed in chrome?
In case of Chrome debugging mode, the JavaScript code runs within Chrome itself (instead of the JavaScriptCore on the device) and communicates with native code via WebSocket. Here, it will use the V8 engine. This allows us to see a lot of information on the Chrome debugging tools like network requests, console logs, etc.
Source: React Native Made Easy
Note that Chrome's V8 Javascript Engine is not the only React Native can use, you could debug in Safari as well and the code would run on Safari's JavascriptCore. See this for more
2.will the device also execute code ? if it is, what's the relationship between it and chrome? if not, how does the app run in device?
No, the JS code executes only in one place, either the browser's javascript engine if you are debugging, thus communicating with the device via Websockets, or the JavascriptCore of the device if running without debugging.
I tried using very simple HTML to create several links to several batch files on my server that are intended to run when users click on the links. Using Chrome, every time I click on one of those files my browser displays the script itself (even though its a .bat) and doesn't actually run the script. Internet Explorer runs it every time, however all the users on the network use Chrome for web browsing.
Is there any way to force Chrome (preferably through HTML or VB or some other scripting on the page itself rather than change all of the users' browser settings) to run these batch files when the user clicks on the link?
The answers given so far - that it's "not possible" - are incorrect or outdated. Using Chrome Apps you can call executables (called "hosts") if they are registered with Chrome. Of course a Chrome App is a client application so you need to distribute it.
See https://developer.chrome.com/extensions/nativeMessaging#examples
HTML, JS on browser cannot run shell command, command line. You have to implement server script to execute your bat file then call it from HTML, JS via Ajax or direct link.
I am using GoogleApis to upload documents to Google Drive using the InsertMediaUpload class from the FilesResource namespace and the Upload method. It is working well for me with the following exception:
After calling InsertMediaUpload, a browser window appears asking the user to log into their Google (usually Gmail) account. If the user simply closes the browser window instead of clicking on "Accept" or "Cancel" then the current process appears to be hung. I suppose there should a timeout of a minute or two so that if the user opts to not log in the current windows application will not simply hang and stop working indefinitely.
There is no need for sample code here. What should happen when the user simply closes the browser window instead of clicking cancel if they are no longer interested in uploading a document? Crashing (or hanging) the current process should not be a possibility, but that is what occurs. One would hope closing the browser window would have the same effect as clicking the cancel button -- just another way of opting out of an upload to Google Drive, right?
Thanks in advance for any help with this.
You're not supposed to get authentication message from InsertMediaUpload class. You should handle authentication by yourself. Authentication browser window you get is for your development convenience, not for production code. Please take a look at .net quickstart. In this quickstart, you'll see GetAuthorization method which handles authentication. Modify this method on your needs and you'll get what you want.