ERROR for jp#gc - Firefox Driver Config - javascript

Hi All,
When i run the web page using Jmeter webdriver sampler in my device with (Indian server) I can achieve my task successfully without any issues, but when the same .jmx file is run on another device with (US server) it throws an error (I have attached that error as image format). I am sure that there is no issues in scripting and please let me know, what could I do to over come this issue?

Most likely your "US Server" doesn't have WebDriver Set plugin installed. You will need to install WebDriver Set on the "US Server" and restart JMeter there to pick up the new libraries.
The fastest and the easiest way of installing JMeter Plugins and keeping them up to date is using JMeter Plugins Manager, the relevant package is Selenium/WebDriver Support

Related

Launching on android WEBAPP with ADB

Is there a method to launch a web app using adb?
The web app is created using manifest.json and save on android using chrome browser.
I've tried to get the package name of the web application using adb shell pm list packages but nothing seems to match.
I want to launch my web app this way adb shell am start -n com.package.name/com.package.name.ActivityName
I've also tried this way adb shell am start -a android.intent.action.VIEW -d "url". This works but it is not what I am looking for.
Assuming you are coming from Javascript world (as you could have done this by looking at adb logs), this should be what you are looking for
adb shell am start -a com.google.android.apps.chrome.webapps.WebappManager.ACTION_START_WEBAPP -n com.android.chrome/org.chromium.chrome.browser.webapps.WebappLauncherActivity --es "org.chromium.chrome.browser.webapp_url" "{your_url}" --es "org.chromium.chrome.browser.webapp_mac" "{webapp_mac}"
Note that this url has to match the url/url-ending you have mentioned in the start_url that you have mentioned in the manifest.json of yours, else it will just open it as another chrome tab.
Another caveat here is you have to pass web app mac validation check, which is done by the core android class mentioned here - WebappAuthenticator
Chrome does not keep a store of valid URLs for installed web apps
(because it cannot know when any have been uninstalled). Therefore,
upon installation, it tells the Launcher a message authentication code
(MAC) along with the URL for the web app, and then Chrome can verify
the MAC when starting e.g. {#link #FullScreenActivity}. Chrome can
thus distinguish between legitimate, installed web apps and arbitrary
other URLs.
I gave it a shot to open one of the webapps I own. I gave up after a bit, getting lost in the cryptic algos. Maybe you will have some luck with it. All the best!!!

How to Disable "Chrome --disable-web-security" in Jmeter Webdriver Sampler?

We are trying to Performance Test one of our web Applications which has Security feature enabled using JMeter and we are unable to pass Chrome --disable-web-security in webdriver Sampler and was wondering do we have any option to pass Chrome --disable-web-security when the webdriver sampler launches the chrome Browser ?
Below is the sample command line which we are using to disable web security manually to test the application.
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-web-security --user-data-dir="chrome"
Unfortunately you cannot, you can ask WebDriver Sampler plugin developers or maintainers to include this option into one of the future releases via JMeter Plugins Support Forum
In the meantime you can switch to JSR223 Sampler and write your Selenium-related code in Groovy language, it will give you full control and flexibility, example code:
System.setProperty('webdriver.chrome.driver', '/path/to/chromedriver')
def options = new org.openqa.selenium.chrome.ChromeOptions()
options.addArguments('--disable-web-security')
def chromedriver = new org.openqa.selenium.chrome.ChromeDriver(options)
chromedriver.get('http://example.com')
Enabling the Chrome Driver Config Option, "Allow Insecure Certs" worked well for my requirement.Could be worth a try.
Chrome Driver Config Screenshot

How to use a browser on a remote server for an automated tests

I inherited a project where the person wrote tools to test our site's UI using JQuery and JS.
I don't know too much about it other than it requires a browser to be spawned and I think the tool uses JS to interact with iframes to see if it's the expected values.
My job is to get this tool to run on a remote server and post the results to Jenkins.
The remote test server and staging server is linux. From our staging server, I want to write a script to spawn a browser and run cmds from the tool to test our UI. I ran the following manually:
ssh -X user#remote_test_server /usr/bin/firefox
However, the remote server says:
Error: no display specified
Is there a way to spawn a browser for automated testing from one headless server to another? Thanks in advance for your help.
I faced a similar problem when I tried to automate a GUI installation program. While there are quite some different possibilities to choose from (e.g. Xnest, Xephyr?), I ended up using vncserver, because it's relatively easy to debug the GUI session this way.
You need to create a vncpassword file, I think:
mkdir -p $HOME/.vnc
chmod 0700 $HOME/.vnc
echo MyLittlePassword | vncpasswd -f > $HOME/.vnc/passwd
chmod 0600 $HOME/.vnc/passwd
Starting the server is then quite straightforward
vncserver
export DISPLAY=:1
/usr/bin/firefox&
...
Now it is possible to connect to the VNC server with a VNC viewer of your choice. But beware there may be no window manager, depending on the X startup scripts of your environment.
Shutting the server down
vncserver -kill :1
In the configuration of Jenkins project , specify the
Build Environment
Start Xvfb before the build, and shut it down after.
#

D3 samples in a Microsoft Stack

We're trying to get familiar with D3 (http://d3js.org/), in particular samples such as http://bl.ocks.org/mbostock/3306362 and http://bl.ocks.org/mbostock/2206590. It seems all these samples use local file IO to load geolocation info. The following code snippets are common:
queue()
.defer(d3.json, "/mbostock/raw/4090846/us.json")
.defer(d3.tsv, "unemployment.tsv")
.await(ready)
while other samples often use this signature to load data:
d3.json("someJSONFile.json", function(error, uk) {
console.log(uk);
});
We've created several local html files to test out the samples, but we're running into security issues. It's apparent the script is accessing a local file, which is really giving us problems in a Microsoft stack (Apple or Linux isn't an option at this time, though we have tried Chrome, with no success). How can we enable the html file or refactor the script to have access to the local files?
You need to host the files through a web server since web browsers restrict what types of files can be accessed locally. The simplest way to do this on a windows machine:
Install python
Navigate to the directory holding your example with cmd.exe. Holding down shift, right clicking on the folder with the example and selecting Open Command Window Here is the easiest way to do this.
On the command prompt, enter python -m SimpleHTTPServer 8000, or python -m http.server 8000, on newer versions to start a web server.
Open a web browser (I would really suggest chrome, the dev tools are way ahead of ff and ie), go to 127.0.0.1:8000. The example should show up.

Writing a pseudo terminal in python for a web based ubuntu terminal

I am interested in writing a web based terminal which can execute and autocomplete the commands in ubuntu terminal.
I have fiddled with Anyterm http://www.anyterm.org which uses ROTE: "a simple C library for VT102 terminal emulation" at the backend server and javascript/html for the terminal ui. The problem was that I couldn't have it open two terminals in the same window.
After doing some research I've decided to write a terminal server/pseudo terminal (whichever is the right terminology) in python which can:
execute commands in ubuntu terminal (such as ls, grep etc...)
autocomplete the commands (like $gedi (pressed tab) $gedit)
and have multiple instances of terminal open at the same time (when typed ls in one, the other terminal won't recognize ls as the last command since its another terminal session)
I have found that with pty python module I can write a pseudo terminal
however I'm new to python and I couldn't even get the example on that page to work.
I'm planning to have the python script serve a http server with the javascript/html terminal ui I would write (this was the main reason I wanted to choose python for this project). Then I want to let the web ui talk to the backend terminal "server" and get the results back to the web ui.
If you could point me in the right direction, maybe tell me which module I should use -if not pty- and give me some ideas on how to write the python pseudo terminal server I would appreciate it.
I know javascript/php and familiar with bash scripting- At this point I could go for a C based or python based backend server, is python right for this project?
Note: I'm planning to write a ui that uses ajax post or get methods to retrieve the terminal output from backend server.
You need to learn the basic terminology first. The shell is the program that interprets your input command lines, such as grep "foo" abc.txt. A terminal emulator is a program that mimics a terminal. Terminal is a device with display and keyboard that one
used in 1970s to access a UNIX mainframe. A pseudoterminal, pty is the device node supporting terminal emulators, as opposed to "real terminal devices" (tty1) for example.
Now, you could either build a shell, that would work in terminal instead of bash or dash; or you could build a terminal emulator that is usable over the internet; you could run any existing shell in it. Both are challenging tasks by themselves.
Python documentation is not of much use, I recommend you should start by googling more of these concepts first - and not only python references, but C, C++ too.
And lastly, if you want to run Emacs or nano or some other advanced program in your shell, you want to use the pty module.
I had a friends who did something similar but he did it over Google chat, I don't know how much help it will be but take a look at xmpp (python modual) maybe it could help you, or even here is a link to his source code:
chatIO
I didn't work with him on it but it was really easy for him to use
Good Luck

Categories