I have Hybrid Framework using Selenium Webdriver that successfully executes test cases against Firefox, Chrome and IE. Now, I wanted to run this entire suite using Browserstack.
However, when I try to access the application I make entries in the host file - the ipaddress and the host name. This makes sure that I'm hitting the exact server.
Using Java code on https://www.browserstack.com/automate/java I'm able to execute a sample script.
However, how can I pass the ipaddress mapping of my application to my Selenium instance when executing it on Browserstack?
The BrowserStack Local Testing feature (https://www.browserstack.com/local-testing) should help you test your private servers configured in your hosts file. Please follow these steps:
1) Download and execute the Local Testing binaries (https://www.browserstack.com/local-testing#command-line) using the following command:
./BrowserStackLocal ACCESS_KEY -forcelocal
The '-forcelocal' parameter will route all traffic via your machine which allows you to test servers configured in your hosts file on BrowserStack.
2) Add the capability 'browserstack.local'='true' in your test scripts and execute them.
Related
So apologies if what I ask is trivial but I am experimenting with Memcached and Jmeter. I have a Memcached server setup (as far as I can tell) and am able to make telnet requests to it via telnet IP PORT and additionally set and get using commands set and get appropriately.
Now point me to a different application if perhaps this is the wrong choice; but my understanding was that Jmeter should allow me to pound the server with equivalent Set and Get requests.
Unfortunately the experimental platform is a remote linux PC running Rockylinux which is similar to CentOS / RedHat to my understanding (I didn't set this part up); and as a result I do not have a GUI to launch while on the Linux PC. I have however opened Jmeter up on my local PC on windows and understand I should be able to send the test file over and run it.
I followed these instructions to try to setup a TCP sampler and set the "text to send" field as below; after doing the additional step in the link regarding the precompiler.
set tutorialspoint 0 900 9${CR}${LF}
memcached${CR}${LF}
quit${CR}${LF}
Running the above as a headless jmeter session doesn't generate any errors called [./jmeter -n -t "Sample.jmx" -l testresults.jtl"] but when I connect via telnet I'm also not seeing the value for the key "tutorialspoint" get updated. When manually doing the get and set I am seeing updates. Any ideas what I could be doing wrong? Checking the log indicates ResponseCode 200 OK as expected. Is there a good method to debug something in a Headless setup?
Thanks for your time.
I believe the easiest way is using Memcached Java Client library
Download spymemcached-2.12.3.jar and drop it to "lib" folder of your JMeter installation (or any other location in JMeter Classpath)
Restart JMeter to pick the .jar up
Add JSR223 Sampler to your test plan and use the following code snippets:
def client = new net.spy.memcached.MemcachedClient(new InetSocketAddress('your-memcached-host', your-memcached-port)) - for connecting to the server
client.set('tutorialspoint', 900, 'memcached').done to write memcached to the tutorialspoint key for 15 minutes
client.get('tutorialspoint') - to read the value of tutorialspoint key
client.shutdown() - to disconnect
More information on Groovy scripting in JMeter: Apache Groovy - Why and How You Should Use It
Demo:
I am trying to automate test to webrtc application and I'm trying to do it with multiple users. I created a setUp as below.
`
ArrayList<String> prefs = new ArrayList<String>();
prefs.add("--use-fake-device-for-media-stream");
prefs.add("--use-fake-ui-for-media-stream");
System.setProperty("webdriver.chrome.driver", "C:\\....\\resources\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments(prefs);
driver = new ChromeDriver(options);
driver.get("https://......");`
but when I use "--use-fake-ui-for-media-stream", the following remote address appears in the logs of the media server of the app.(I used this to disable the security popup for camera and mic.)
remote address looks like: 79beeb9e-ff01-4e69-906c-5be9cab979e6
when I don't use it, the remote address looks like this: 172.17.x.x
Therefore, I cannot connect to the meeting room, the server refuses the remote address.
When I remove "--use-fake-ui-for-media-stream" and put "--user-data-dir=C:\Users....\Local\Temp\...", I overcome this problem, but this time I can only connect to a single chromedriver on the Jmeter, the other chromedrivers are not working. I integrated testcases to Jmeter with Junit request.
I want to use this code for multiple users but I only could do it for a user or I could not connected.
How can i overcome this problem?
When first ChromeDriver instance is launched the profile directory gets locked and it cannot be re-used by 2nd, 3rd, etc. instance.
You can do something like:
prefs.add("--profile-directory=User" + org.apache.jmeter.threads.JMeterContextService.getContext().getThreadNum());
so each instance will have it's own separate profile folder.
More information:
open multiple chrome profile with selenium
JMeterContextService JavaDoc
How to Use JUnit With JMeter
While trying to execute a Selenium test on BrowserStack with the capability 'browserstack.local' as 'true' I am getting the following exception-
org.openqa.selenium.WebDriverException: [browserstack.local] is set to true but local testing through BrowserStack is not connected.
If I remove the capability 'browserstack.local' then the test executes, however, it does not access the private network application. I tried to search other online resources around this exception, however, could not find any details.
URL URLObj = new URL("https://" + USERNAME + ":" + KEY + "#hub-cloud.browserstack.com/wd/hub");
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("device", "iPhone 8 Plus");
caps.setCapability("real_mobile", "true");
caps.setCapability("browserstack.local", "true");
AppiumDriver webDriver = new IOSDriver(URLObj, caps);
The excepted result is that the test should run and the private network application should be accessible. Also, the above exception should not be thrown.
BrowserStack provides the Local testing feature to test the internal websites which are not accessible publicly.
Local testing feature is enabled by setting the capability 'browserstack.local' to the value 'true' and starting the BrowserStackLocal binary.
Have you started the BrowserStackLocal binary? You can start the binary by executing the following command in your command prompt-
BrowserStackLocal.exe --key ACCESS_KEY
The error - '[browserstack.local] is set to true but local testing through BrowserStack is not connected.' usually occurs when the BrowserStackLocal binary is not running.
I can think of the following causes for the error-
When the test script and BrowserStackLocal binary connection do not use the same username and access key. You can verify the username and access key associated with your account here, https://www.browserstack.com/accounts/settings
When the test script and BrowserStackLocal binary connection do not use the same local identifier
When a new BrowserStackLocal binary is invoked with the same parameters and hence the old connection is closed thereby displaying the error
Binary disconnected at your end due to some network connectivity issues
You can make sure that the test script and the BrowserStackLocal binary uses the same access key and the same local identifier, in case, if you are using a Local Identifier for the BrowserStackLocal binary connection. Also, make sure that all the old connections of BrowserStackLocal binary are terminated before starting a new one with the same parameters. Read more on Local testing here, https://www.browserstack.com/local-testing.
I received this error because I had 2 instances of the BrowserstackLocal.exe running.
I was able to see them both in the task manager. I opted to end task on one, and they both quit. I used the CMD prompt to re-run the BrowserstackLocal.exe (with my key) and re-ran my test, and it worked.
Apart from what you are doing, there is another step involved in Browserstack Local testing. You can check it here.
Basically, there is a binary (executable) file which you need to run on your system(on which the tests will be executed) which will route the traffic via your network to Browserstack's network. This will resolve all your private URLs inside Browserstack's network.
I am trying to setup an application server for AWS Lambda but on a local network so that an application won't have to go out to the internet to execute. I would prefer to use a linux box and my programming environment is Java.
The skill from the echo will execute and then communicate with the local server rather than going out to the internet and communicating with Amazon's application server.
My question is this: How do I setup the application server to handle the skill? I've done the example from Amazon, do I only need to have the linux box run the Java application or is there more to the setup than that? I see there are AMIs (Amazon Machine Images) but can I deploy those locally or are they only for use on the AWS console?
Any insight into this would be great, thank you.
So this is how usual interaction between echo works:
User--->Echo--->Skill--->(Internet)Applicaton server (I'm using Amazon hosted AWS lambda)
I would like to use :
User--->Echo--->Skill--->(LAN)Application server (without ever using the internet).
Currently I have setup echo and a skill but no application server on the LAN. What do I need for the application server? JAWS and something else?
I'm not sure if this question is still relevant or not, but I'm using DEEP Framework to test the code locally and/or deploy it on AWS Lambda. Check this out:
npm install deepify -g
deepify run-lambda --help
run-lambda#1.6.8 - Run Lambda function locally
Usage example: deepify run-lambda path/to/the/lambda -e='{"Name":"John Doe"}'
Arguments:
path: The path to the Lambda (directory of handler itself)
Options:
--event|-e: JSON string used as the Lambda payload
--skip-frontend-build|-f: Skip picking up _build path from the microservices Frontend
--db-server|-l: Local DynamoDB server implementation (ex. LocalDynamo, Dynalite)
--version|-v: Prints command version
--help|-h: Prints command help
Also, you might want consider using the server option:
deepify server --help
server#1.6.9 - Run local development server
Usage example: deepify server path/to/web_app -o
Arguments:
path: The path to the Lambda (directory of handler itself)
Options:
--build-path|-b: The path to the build (in order to pick up config)
--skip-frontend-build|-f: Skip picking up _build path from the microservices Frontend
--skip-backend-build|-s: Skip building backend (dependencies installation in Lambdas and linking aws-sdk)
--skip-build-hook|-h: Skip running build hook (hook.build.js)
--port|-p: Port to listen to
--db-server|-l: Local DynamoDB server implementation (ex. LocalDynamo, Dynalite)
--open-browser|-o: Open browser after the server starts
--version|-v: Prints command version
--help|-h: Prints command help
Disclosure: I am one of the contributors to this framework
I'm trying to run some Selenium tests for an application while it is started, but am getting a runtime exception:
Could not start Selenium session: HTTP method POST is not supported by this URL
The application we made has no need for a POST method. Is there any way to make Selenium work without needlessly implementing one? Why is it required in the first place?
The parameters to pass for DefaultSelenium are as follows according to the api documentation:
serverHost - the host name on which the Selenium Server resides
serverPort - the port on which the Selenium Server is listening
browserString - the command string used to launch the browser
browserURL - the starting URL including just a domain name
You need to direct it to where an instance of your selenium server is running (which could be remotely or locally). I am going to guess that localhost:8080 is where you have deployed a separate application that you want to test with selenium.
So, the details you provide are for the selenium server, not for your application. If you download the standalone server and run it locally, you only need to change the port to match that of the selenium server instance. You can download the selenium standalone server from their main website, and when you run it, it will tell you the port that it uses (by default it is 4444).
Why not just use WebDriver instead?
WebDriver driver = new FirefoxDriver();
driver.get("URL")
You can read more about how to use it on the documentation page on the selenium website.