Development

I have a test scenario where the web application checks for the user’s leave intent i.e., mouse hovering from the page to the browser close and then a frame gets triggered. Is there any way to do it?

Edit: So the dev implementation is that when the user is moving to the top of the document frame gets triggered and it is not browser close but moving to corner of the document.

I am using Selenium 4 in java to control Chrome and Edge and other browsers in order to test a video call app. I have a test where I’m starting up 2 different browsers at once in order to get them to communicate with each-other. I am using OBS to provide virtual webcams with customizable feeds so that I can switch input for either browser.
When I start up 2 Chromium-family browsers I get an issue that only the first one I launch (at a time) can get and show the full list of cameras while the other one shows nothing – even after waiting 15+ minutes. If I launch Firefox and Chrome as my browsers then they both can access the webcam list.
Since Firefox is not planned to be supported for the first version of the webapp, that leaves mostly chromium family browsers for me to test with (I’m on windows so I can’t test safari at this point). Does anyone know why this is happening and how I could fix it?
How I start Chrome:
ChromeOptions chromeOptions= new ChromeOptions();
chromeOptions.addArguments(“use-fake-ui-for-media-stream”);
chromeDriver = new ChromeDriver(chromeOptions);

How I start Edge:
EdgeOptions edgeOptions= new EdgeOptions();
edgeOptions.addArguments(“use-fake-ui-for-media-stream”);
edgeDriver = new EdgeDriver(edgeOptions);

How I start Firefox:
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.addPreference(“browser.cache.disk.enable”, false);
firefoxOptions.addPreference(“browser.cache.disk.capacity”, 0);
firefoxOptions.addPreference(“browser.cache.disk.smart_size.enabled”, false);
firefoxOptions.addPreference(“browser.cache.disk.smart_size.first_run”, false);
firefoxOptions.addPreference(“browser.sessionstore.resume_from_crash”, false);
firefoxOptions.addPreference(“browser.startup.page”, 0);
firefoxOptions.addPreference(“media.navigator.permission.disabled”, true);
firefoxOptions.addPreference(“device.storage.enabled”, false);
firefoxOptions.addPreference(“media.gstreamer.enabled”, false);
firefoxOptions.addPreference(“browser.startup.homepage”, “about,blank”);
firefoxOptions.addPreference(“browser.startup.firstrunSkipsHomepage”, false);
firefoxOptions.addPreference(“extensions.update.enabled”, false);
firefoxOptions.addPreference(“app.update.enabled”, false);
firefoxOptions.addPreference(“network.http.use-cache”, false);
firefoxOptions.addPreference(“browser.shell.checkDefaultBrowser”, false);
firefoxDriver = new FirefoxDriver(firefoxOptions);

In this code i want to navigate to the year 2022 and select July and print that result in the console but the issue is that in the else if condition when checking when this particular condition is encounted where the year is 2022 and the month is december it is passing and it is navigating to next Button which is January 2023 so the loop keeps on running and i cannot get my desired result
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.time.Duration;

public class DatePicker {
public static void main(String[] args) {
WebDriver driver = new ChromeDriver();
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5000));

driver.get(“https://seleniumpractise.blogspot.com/2016/08/how-to-handle-calendar-in-selenium.html”);

driver.findElement(By.id(“datepicker”)).click();

String desiredMonth = “July”;
String desiredYear = “2022”;

while (true) {
String year1 = driver.findElement(By.className(“ui-datepicker-year”)).getText();
String month1 = driver.findElement(By.className(“ui-datepicker-month”)).getText();

if (year1.equals(desiredYear) && month1.equalsIgnoreCase(desiredMonth)) {
System.out.println(“Desired date reached: the year is ” + year1 + ” and the month is ” + month1);
break;
} else if (year1.equals(desiredYear) && month1.compareTo(desiredMonth) < 0) {
driver.findElement(By.className(“ui-icon-circle-triangle-e”)).click();
} else {
driver.findElement(By.className(“ui-icon-circle-triangle-w”)).click();
}

// Wait for the changes to take effect
wait.until(ExpectedConditions.presenceOfElementLocated(By.className(“ui-datepicker-year”)));
}

driver.quit();
}
}