0

Following these steps, I've been able to run a script to log in to a web app I'm testing on Microsoft Edge using Groovy in a JSR223 Sampler in JMeter. My script clicks on a "Sign In" button, which then automatically signs me in (presumably through my credentials used to sign into my computer*). However, this test case should be able to log in as multiple users, so having me automatically sign in with my credentials isn't the intended use case. Through some trial-and-error, I found that I don't get automatically signed in when using the web app in Edge either (a) with inPrivate mode or (b) with a Guest account. Using either one of these approaches seems the most intuitive way to resolve this issue, but I am not sure if there's a way to do either (or both) of them in JMeter.

*It's a company laptop and I can't log in as a local user.

samm82
  • 240
  • 4
  • 14

1 Answers1

0

If you're smart enough to instantiate and start EdgeDriver you should be able to do configure it as well.

Capabilities and EdgeOptions article shows available parameters.

For particular you case it would be something like:

def options = new EdgeOptions()
options.setCapability("InPrivate", true)

or if you prefer a full piece of code to copy and paste:

System.setProperty("webdriver.edge.driver", "../lib/MicrosoftWebDriver.exe")
def options = new EdgeOptions()
options.setCapability("InPrivate", true)
def driver = new org.openqa.selenium.edge.EdgeDriver(options)
driver.get("http://jmeter.apache.org")

More information on Groovy scripting in JMeter: Apache Groovy - Why and How You Should Use It

However in general I would rather look into the way of impersonating a different domain user via SSO using i.e. MITM proxy capable of adding relevant headers to the browser controller by the WebDriver

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • 1
    I tried using the setCapability method to set inPrivate mode to "true" using the following strings, but none of them started Edge in inPrivate mode: "InPrivate", "inPrivate", "inprivate", "Private", "private", "incognito", "Incognito", and "start-in-incognito". – samm82 Apr 15 '21 at 21:57
  • Following [this Selenium guide](https://www.selenium.dev/documentation/en/driver_idiosyncrasies/driver_specific_capabilities/), I also tried using the addCommandSwitches method, but I got a MissingMethodException. The same thing happened with setCapability, addArguments, and addAdditionalCapability. – samm82 Apr 15 '21 at 21:57