Still not working lol

This commit is contained in:
2023-04-27 15:59:52 +02:00
parent 23de653bde
commit 66e8699afe
+28 -2
View File
@@ -68,6 +68,17 @@ namespace Test_Merge
service.Port = 5555;
FirefoxOptions options = new FirefoxOptions();
options.SetPreference("media.peerconnection.enabled", false);
//FirefoxProfile profile = new FirefoxProfile();
//profile.SetPreference("layout.css.devPixelsPerPx", "2.0");
//options.Profile = profile;
FirefoxProfile profile = new FirefoxProfile();
profile.SetPreference("media.navigator.video.default_width", 1920);
profile.SetPreference("media.navigator.video.default_height", 1080);
options.Profile = profile;
options.AddArgument("--window-size=" + windowWidth + "," + windowHeight + "");
options.AddArgument("--disable-web-security");
options.AddArgument("--same-site-none-secure");
@@ -93,9 +104,15 @@ namespace Test_Merge
var loginSessionCookie = new Cookie(loginSessionCookieName, loginSessionValue, COOKIE_HOST, "/", DateTime.Now.AddDays(5));
Actions actions = new Actions(Driver);
Driver.Navigate().GoToUrl("https://f1tv.formula1.com/");
//TEST
//Driver.Manage().Window.Position = new Point(0, 0);
//Driver.Manage().Window.Size = new Size(1920, 1080);
Screenshot screenshot = ((ITakesScreenshot)Driver).GetScreenshot();
screenshot.SaveAsFile(@"C:\Users\Moi\Desktop\imgDump\Decode\FirstTest.png", ScreenshotImageFormat.Png);
//TEST
Driver.Manage().Cookies.AddCookie(loginCookie);
Driver.Manage().Cookies.AddCookie(loginSessionCookie);
@@ -181,18 +198,27 @@ namespace Test_Merge
}
public Bitmap Screenshot()
{
//bitmovinplayer-video-slave-embeddedPlayer
Bitmap result = new Bitmap(100, 100);
if (Ready)
{
/*
Screenshot scrsht = ((ITakesScreenshot)Driver).GetScreenshot();
// Get the raw bytes of the screenshot
*/
//Driver.Manage().Window.Position = new Point(0, 0);
//Driver.Manage().Window.Size = new Size(1920, 1080);
IWebElement element = Driver.FindElement(By.Id("bitmovinplayer-video-slave-embeddedPlayer"));
Screenshot scrsht = ((ITakesScreenshot)element).GetScreenshot();
byte[] screenshotBytes = Convert.FromBase64String(scrsht.AsBase64EncodedString);
// Create a new MemoryStream from the bytes
MemoryStream stream = new MemoryStream(screenshotBytes);
// Create a new Bitmap object from the MemoryStream
result = new Bitmap(stream);
}
result.Save(@"C:\Users\Moi\Desktop\imgDump\Decode\Test.png");
return result;
}
public string GetCookie(string host, string name)