NOW IT FUCKING DOES NOT SUCK ANYMORE LETSGOOOOOOOOOOOO
This commit is contained in:
@@ -7,4 +7,9 @@ you will need to take a couple of folders and files in the /bin/debug or /bin/re
|
|||||||
You need to take the recoverCookiesCSV.py in ./Test_Merge and put it in the /bin/... folder
|
You need to take the recoverCookiesCSV.py in ./Test_Merge and put it in the /bin/... folder
|
||||||
Same for the all geckodriver-v0.xx.x-win32 folder
|
Same for the all geckodriver-v0.xx.x-win32 folder
|
||||||
|
|
||||||
You also have to change the TESS_DATA_FOLDER constant in the Windows.cs file. A small one is included in the project files
|
You also have to change the TESS_DATA_FOLDER constant in the Windows.cs file. A small one is included in the project files
|
||||||
|
|
||||||
|
Add those two environnement variables :
|
||||||
|
|
||||||
|
1. MOZ_HEADLESS_WIDTH => 3840
|
||||||
|
2. MOZ_HEADLESS_HEIGHT => 2160
|
||||||
+35
-10
@@ -92,17 +92,30 @@ namespace Test_Merge
|
|||||||
string loginSessionValue = GetCookie(COOKIE_HOST, loginSessionCookieName);
|
string loginSessionValue = GetCookie(COOKIE_HOST, loginSessionCookieName);
|
||||||
|
|
||||||
int windowWidth = 1920;
|
int windowWidth = 1920;
|
||||||
int windowHeight = 1200;
|
int windowHeight = 768;
|
||||||
|
|
||||||
var service = FirefoxDriverService.CreateDefaultService(GECKODRIVER_FILENAME);
|
var service = FirefoxDriverService.CreateDefaultService(GECKODRIVER_FILENAME);
|
||||||
service.Host = "127.0.0.1";
|
service.Host = "127.0.0.1";
|
||||||
service.Port = 5555;
|
service.Port = 5555;
|
||||||
|
|
||||||
|
FirefoxProfile profile = new FirefoxProfile();
|
||||||
FirefoxOptions options = new FirefoxOptions();
|
FirefoxOptions options = new FirefoxOptions();
|
||||||
|
//profile.SetPreference("full-screen-api.ignore-widgets", true);
|
||||||
|
//profile.SetPreference("media.hardware-video-decoding.enabled", true);
|
||||||
|
//profile.SetPreference("full-screen-api.enabled", true);
|
||||||
|
options.Profile = profile;
|
||||||
|
profile.SetPreference("layout.css.devPixelsPerPx", "1.0");
|
||||||
|
|
||||||
options.AcceptInsecureCertificates = true;
|
options.AcceptInsecureCertificates = true;
|
||||||
options.AddArgument("--headless");
|
options.AddArgument("--headless");
|
||||||
options.AddArgument("--width="+windowWidth);
|
//options.AddArgument("--start-maximized");
|
||||||
options.AddArgument("--height="+windowHeight);
|
//options.AddArgument("--window-size=1920x1080");
|
||||||
|
//options.AddArgument("--width=" + windowWidth);
|
||||||
|
//options.AddArgument("--height=" + windowHeight);
|
||||||
|
//options.AddArgument("-window-size=1920x1080");
|
||||||
|
//options.AddArgument("--width=1920");
|
||||||
|
//options.AddArgument("--height=1080");
|
||||||
|
//profile
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -146,6 +159,7 @@ namespace Test_Merge
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
//Could not locate the cookie button
|
//Could not locate the cookie button
|
||||||
|
Screenshot("ERROR104");
|
||||||
Driver.Dispose();
|
Driver.Dispose();
|
||||||
return 104;
|
return 104;
|
||||||
}
|
}
|
||||||
@@ -173,10 +187,10 @@ namespace Test_Merge
|
|||||||
// It does not matter if the feed is paused because when changing channel it autoplays
|
// It does not matter if the feed is paused because when changing channel it autoplays
|
||||||
actions.SendKeys(OpenQA.Selenium.Keys.Space).Perform();
|
actions.SendKeys(OpenQA.Selenium.Keys.Space).Perform();
|
||||||
//Clicks on the settings Icon
|
//Clicks on the settings Icon
|
||||||
|
|
||||||
int tries = 0;
|
int tries = 0;
|
||||||
bool success = false;
|
bool success = false;
|
||||||
while (tries < 50 && !success)
|
while (tries < 100 && !success)
|
||||||
{
|
{
|
||||||
Thread.Sleep(100);
|
Thread.Sleep(100);
|
||||||
try
|
try
|
||||||
@@ -196,16 +210,19 @@ namespace Test_Merge
|
|||||||
tries++;
|
tries++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(success = false)
|
if (!success)
|
||||||
{
|
{
|
||||||
Screenshot("ERROR105");
|
Screenshot("ERROR105");
|
||||||
Driver.Dispose();
|
Driver.Dispose();
|
||||||
return 105;
|
return 105;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Screenshot("BEFOREFULLSCREEN");
|
||||||
|
|
||||||
//Makes the feed fullscreen
|
//Makes the feed fullscreen
|
||||||
|
//Driver.Manage().Window.Size = new System.Drawing.Size(windowWidth, windowHeight);
|
||||||
|
Driver.Manage().Window.Maximize();
|
||||||
WebDriverWait wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(10));
|
WebDriverWait wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(10));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -219,6 +236,8 @@ namespace Test_Merge
|
|||||||
return 106;
|
return 106;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Screenshot("AFTERFULLSCREEN");
|
||||||
|
|
||||||
//STARTUP FINISHED READY TO SCREENSHOT
|
//STARTUP FINISHED READY TO SCREENSHOT
|
||||||
Ready = true;
|
Ready = true;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -228,13 +247,19 @@ namespace Test_Merge
|
|||||||
Bitmap result = new Bitmap(4242, 6969);
|
Bitmap result = new Bitmap(4242, 6969);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Screenshot scrsht = ((ITakesScreenshot)Driver).GetScreenshot();
|
//Screenshot scrsht = ((ITakesScreenshot)Driver).GetScreenshot();
|
||||||
|
//profileriver.SetPreference("layout.css.devPixelsPerPx", "1.0");
|
||||||
|
|
||||||
|
//Screenshot scrsht = Driver.GetFullPageScreenshot();
|
||||||
|
Screenshot scrsht = Driver.GetScreenshot();
|
||||||
|
|
||||||
|
|
||||||
byte[] screenshotBytes = Convert.FromBase64String(scrsht.AsBase64EncodedString);
|
byte[] screenshotBytes = Convert.FromBase64String(scrsht.AsBase64EncodedString);
|
||||||
MemoryStream stream = new MemoryStream(screenshotBytes);
|
MemoryStream stream = new MemoryStream(screenshotBytes);
|
||||||
|
|
||||||
result = new Bitmap(stream);
|
result = new Bitmap(stream);
|
||||||
result.Save(name + ".png");
|
//result.Save(name + ".png");
|
||||||
|
scrsht.SaveAsFile(name + ".png");
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user