0

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?

1 Answers1

0

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:

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • Creating new users didn't work. Because I need to turn off **"--use-fake-ui-for-media-stream"** for the remote address to be fixed. When I create a new user, a security pop-up appears for camera and microphone permissions. Using **""--user-data-dir=C:\Users....\Local\Temp\...""** blocks the pop-up because it's an allowed profile. I actually need to define my own IP for problem solving. – Burak Vural Jul 27 '21 at 11:31