question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Perform Artillery with Selenium&NodeJS

See original GitHub issue

Hello,

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:open
  • Created a year ago
  • Comments:21 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
GeekyDeakscommented, May 26, 2022
1reaction
GeekyDeakscommented, May 12, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Automating performance and load tests with Artillery + Keptn
Francesco Lentini from Artillery shows how you can use Artillery to run load tests and smoke tests to help your services maintain their...
Read more >
artillery node.js performance tests - Rafaela Azevedo
Posts about artillery node.js performance tests written by Rafaela Azevedo. ... Artillery is a npm library that helps you with load tests, ...
Read more >
Artillery | Cloud-scale Load Testing
Artillery is cloud-native, open source, and integrates with your favorite monitoring and CI/CD stack. Load test anything, at any scale. $. npm, docker....
Read more >
A Guide to Load Testing Node.js APIs with Artillery
This article will get you started with load testing your Node.js APIs using Artillery. You'll be able to detect and fix critical performance...
Read more >
How To Run Automation Tests Using Selenium and NodeJS ...
Machine with node setup with npm installed · selenium-webdriver package for using it to run Selenium configurations · Chrome driver package – web ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found