Perform Artillery with Selenium&NodeJS
See original GitHub issueHello,
Thanks for this tool!
I am trying to perform a load test on a web application via Chrome browsers with the help of Selenium and NodeJS. The purpose of using Artillery for my use case is to perform a ramp up schedule of triggering Chrome browsers in a Workload model.
Use Case:
For example: To ramp up to 3 Chrome browsers in 30 seconds. In my Selenium code below, I am instructing Selenium to go to lambdatest.com and capture the text of a header on the homepage and return it. In my YML file, I configured rampTo: 3. The expected output is that I only see 3 instances of the output in console. However, I am seeing numerous instances. Please also refer to “Expected Output” and “Actual Output” below.
Selenium Code
const { Builder, By, Key, until } = require('selenium-webdriver');
const webdriver = require('selenium-webdriver');
async function navigateToLambdaTest() {
let chromeCapabilities = webdriver.Capabilities.chrome();
chromeCapabilities.set('chromeOptions', { 'args':[ '--headless','--disable-dev-shm-usage','--disable-extensions','--no-sandbox']});
chromeCapabilities.set('useAutomationExtension', false);
let driver = await new Builder();
.forBrowser('chrome')
.withCapabilities(chromeCapabilities)
.usingServer('http://localhost:4444/wd/hub')
.build();
try {
await driver.get('http://www.lambdatest.com');
const text = await driver.wait(until.elementIsVisible(driver.findElement(By.xpath("//h1[contains(text(),'Cross Browser')]")),20000)).getText();
console.log("Text is: " + text);
} finally {
await driver.quit();
}
}
module.exports = {
navigateToLambdaTest: navigateToLambdaTest
}
YAML file
config:
target: "http://www.lambdatest.com"
processor: "./SeleniumScript.js"
phases:
- duration: 30
arrivalRate: 1
rampTo: 3
scenarios:
- flow:
- function: "navigateToLambdaTest"
Expected Output
Text is: Cross Browser Testing Cloud
Text is: Cross Browser Testing Cloud
Text is: Cross Browser Testing Cloud
Actual Output on Console:
Phase started: unnamed (index: 0, duration: 30s) 14:57:49(-0400)
| Text is: Cross Browser Testing Cloud
/ Text is: Cross Browser Testing Cloud
\ Text is: Cross Browser Testing Cloud
- Text is: Cross Browser Testing Cloud
| Text is: Cross Browser Testing Cloud
/ Text is: Cross Browser Testing Cloud
/ Text is: Cross Browser Testing Cloud
/ Text is: Cross Browser Testing Cloud
| Text is: Cross Browser Testing Cloud
- Text is: Cross Browser Testing Cloud
| Text is: Cross Browser Testing Cloud
/ Text is: Cross Browser Testing Cloud
| Text is: Cross Browser Testing Cloud
| Text is: Cross Browser Testing Cloud
- Text is: Cross Browser Testing Cloud
- Text is: Cross Browser Testing Cloud
- Text is: Cross Browser Testing Cloud
/ Text is: Cross Browser Testing Cloud
| Text is: Cross Browser Testing Cloud
--------------------------------------
Metrics for period to: 14:58:00(-0400) (width: 8.996s)
--------------------------------------
vusers.created: ................................................................ 10
vusers.created_by_name.0: ...................................................... 10
| Text is: Cross Browser Testing Cloud
| Text is: Cross Browser Testing Cloud
- Text is: Cross Browser Testing Cloud
\ Text is: Cross Browser Testing Cloud
| Text is: Cross Browser Testing Cloud
\ Text is: Cross Browser Testing Cloud
\ Text is: Cross Browser Testing Cloud
- Text is: Cross Browser Testing Cloud
- Text is: Cross Browser Testing Cloud
--------------------------------------
Metrics for period to: 14:58:10(-0400) (width: 8.978s)
--------------------------------------
vusers.created: ................................................................ 10
vusers.created_by_name.0: ...................................................... 10
Text is: Cross Browser Testing Cloud
Phase completed: unnamed (index: 0, duration: 30s) 14:58:20(-0400)
\ Text is: Cross Browser Testing Cloud
--------------------------------------
Metrics for period to: 14:58:20(-0400) (width: 9.004s)
--------------------------------------
vusers.created: ................................................................ 10
vusers.created_by_name.0: ...................................................... 10
Can you please help troubleshoot this (as to why I am seeing more than 3 instances of the output)? Do I have to make any changes to the .yml files?
Please let me know if you need any further details. Thank you!
Issue Analytics
- State:
- Created a year ago
- Comments:21 (11 by maintainers)
Top GitHub Comments
Looks like it was just released @ramgiteng
https://github.com/artilleryio/artillery/releases/tag/v2.0.0-17
I raised a PR to fix this #1443 - as it only really affects tests that ramp from a very low
arrivalRate
, it’s not likely to affect the sustained part of any serious loadtest