Added all the files needed for calibration and detection but it now needs to be wired up
This commit is contained in:
@@ -78,9 +78,17 @@ namespace Test_Merge
|
||||
options.AddArgument("--no-startup-window");
|
||||
|
||||
//ACTUAL STARTUP
|
||||
try
|
||||
{
|
||||
Driver = new FirefoxDriver(service, options);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//Could not start the driver, could be because an other instance is running. make sure its closed before re attempting
|
||||
return 101;
|
||||
}
|
||||
|
||||
|
||||
Driver = new FirefoxDriver(service, options);
|
||||
|
||||
var loginCookie = new Cookie(loginCookieName, loginCookieValue, COOKIE_HOST, "/", DateTime.Now.AddDays(5));
|
||||
var loginSessionCookie = new Cookie(loginSessionCookieName, loginSessionValue, COOKIE_HOST, "/", DateTime.Now.AddDays(5));
|
||||
|
||||
@@ -91,14 +99,32 @@ namespace Test_Merge
|
||||
Driver.Manage().Cookies.AddCookie(loginCookie);
|
||||
Driver.Manage().Cookies.AddCookie(loginSessionCookie);
|
||||
|
||||
Driver.Navigate().GoToUrl("https://f1tv.formula1.com/detail/1000006436/2023-saudi-arabian-grand-prix?action=play");
|
||||
try
|
||||
{
|
||||
Driver.Navigate().GoToUrl(GrandPrixUrl);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//The url is not a valid url
|
||||
Driver.Dispose();
|
||||
return 103;
|
||||
}
|
||||
|
||||
//Waits for the page to fully load
|
||||
Driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(30);
|
||||
|
||||
//Removes the cookie prompt
|
||||
IWebElement conscentButton = Driver.FindElement(By.Id("truste-consent-button"));
|
||||
conscentButton.Click();
|
||||
try
|
||||
{
|
||||
IWebElement conscentButton = Driver.FindElement(By.Id("truste-consent-button"));
|
||||
conscentButton.Click();
|
||||
}
|
||||
catch
|
||||
{
|
||||
Driver.Dispose();
|
||||
return 104;
|
||||
}
|
||||
|
||||
|
||||
//Again waits for the page to fully load (when you accept cookies it takes a little time for the page to load)
|
||||
//Cannot use The timeout because the feed loading is not really loading so there is not event or anything
|
||||
@@ -110,12 +136,11 @@ namespace Test_Merge
|
||||
IWebElement dataChannelButton = Driver.FindElement(By.ClassName("data-button"));
|
||||
dataChannelButton.Click();
|
||||
}
|
||||
catch (OpenQA.Selenium.NoSuchElementException error)
|
||||
catch
|
||||
{
|
||||
//If the data button does not exists its because the user is not connected
|
||||
MessageBox.Show("Could not connect to the F1TV. Please connect to it using your account on chrome and if you already did please wait the process can take a few minuts");
|
||||
Driver.Dispose();
|
||||
return 1;
|
||||
return 102;
|
||||
}
|
||||
//Open settings
|
||||
// Press the space key, this should make the setting button visible
|
||||
@@ -146,7 +171,7 @@ namespace Test_Merge
|
||||
}
|
||||
public Bitmap Screenshot()
|
||||
{
|
||||
Bitmap result = new Bitmap(100,100);
|
||||
Bitmap result = new Bitmap(100, 100);
|
||||
if (Ready)
|
||||
{
|
||||
Screenshot scrsht = ((ITakesScreenshot)Driver).GetScreenshot();
|
||||
|
||||
Reference in New Issue
Block a user