slightly improved the Emulator

This commit is contained in:
2023-05-22 11:29:44 +02:00
parent e650072213
commit 66906cb54e
2 changed files with 63 additions and 46 deletions
+25 -17
View File
@@ -208,9 +208,9 @@ namespace Test_Merge
actions.SendKeys(OpenQA.Selenium.Keys.Space).Perform();
//Clicks on the settings Icon
int tries = 0;
bool success = false;
while (tries < 100 && !success)
int settingsClickTries = 0;
bool settingsClickSuccess = false;
while (settingsClickTries < 100 && !settingsClickSuccess)
{
Thread.Sleep(100);
try
@@ -221,39 +221,47 @@ namespace Test_Merge
SelectElement select = new SelectElement(selectElement);
IWebElement selectOption = selectElement.FindElement(By.CssSelector("option[value^='1080_']"));
selectOption.Click();
success = true;
settingsClickSuccess = true;
}
catch
{
//Sometimes it can crash because it could not get the options to show up in time. When it happens just retry
success = false;
tries++;
settingsClickSuccess = false;
settingsClickTries++;
}
}
if (!success)
if (!settingsClickSuccess)
{
Screenshot("ERROR105");
Driver.Dispose();
return 105;
}
else
{
Thread.Sleep(3000);
}
Screenshot("BEFOREFULLSCREEN");
//Makes the feed fullscreen
//Driver.Manage().Window.Size = new System.Drawing.Size(windowWidth, windowHeight);
int fullScreenClickTries = 0;
bool fullScreenClickSuccess = false;
Driver.Manage().Window.Maximize();
WebDriverWait wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(10));
try
//WebDriverWait wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(10));
while (fullScreenClickTries < 100 && !fullScreenClickSuccess)
{
IWebElement fullScreenButton = Driver.FindElement(By.ClassName("bmpui-ui-fullscreentogglebutton"));
fullScreenButton.Click();
Thread.Sleep(150);
try
{
IWebElement fullScreenButton = Driver.FindElement(By.ClassName("bmpui-ui-fullscreentogglebutton"));
fullScreenButton.Click();
fullScreenClickSuccess = true;
}
catch
{
fullScreenClickSuccess = false;
fullScreenClickTries++;
}
}
catch
if (!fullScreenClickSuccess)
{
Screenshot("ERROR106");
Driver.Dispose();