NOW IT FUCKING DOES NOT SUCK ANYMORE LETSGOOOOOOOOOOOO
This commit is contained in:
@@ -8,3 +8,8 @@ You need to take the recoverCookiesCSV.py in ./Test_Merge and put it in the /bin
|
||||
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
|
||||
|
||||
Add those two environnement variables :
|
||||
|
||||
1. MOZ_HEADLESS_WIDTH => 3840
|
||||
2. MOZ_HEADLESS_HEIGHT => 2160
|
||||
@@ -92,17 +92,30 @@ namespace Test_Merge
|
||||
string loginSessionValue = GetCookie(COOKIE_HOST, loginSessionCookieName);
|
||||
|
||||
int windowWidth = 1920;
|
||||
int windowHeight = 1200;
|
||||
int windowHeight = 768;
|
||||
|
||||
var service = FirefoxDriverService.CreateDefaultService(GECKODRIVER_FILENAME);
|
||||
service.Host = "127.0.0.1";
|
||||
service.Port = 5555;
|
||||
|
||||
FirefoxProfile profile = new FirefoxProfile();
|
||||
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.AddArgument("--headless");
|
||||
options.AddArgument("--width="+windowWidth);
|
||||
options.AddArgument("--height="+windowHeight);
|
||||
//options.AddArgument("--start-maximized");
|
||||
//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
|
||||
{
|
||||
@@ -146,6 +159,7 @@ namespace Test_Merge
|
||||
catch
|
||||
{
|
||||
//Could not locate the cookie button
|
||||
Screenshot("ERROR104");
|
||||
Driver.Dispose();
|
||||
return 104;
|
||||
}
|
||||
@@ -176,7 +190,7 @@ namespace Test_Merge
|
||||
|
||||
int tries = 0;
|
||||
bool success = false;
|
||||
while (tries < 50 && !success)
|
||||
while (tries < 100 && !success)
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
try
|
||||
@@ -197,15 +211,18 @@ namespace Test_Merge
|
||||
}
|
||||
}
|
||||
|
||||
if(success = false)
|
||||
if (!success)
|
||||
{
|
||||
Screenshot("ERROR105");
|
||||
Driver.Dispose();
|
||||
return 105;
|
||||
}
|
||||
|
||||
Screenshot("BEFOREFULLSCREEN");
|
||||
|
||||
//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));
|
||||
try
|
||||
{
|
||||
@@ -219,6 +236,8 @@ namespace Test_Merge
|
||||
return 106;
|
||||
}
|
||||
|
||||
Screenshot("AFTERFULLSCREEN");
|
||||
|
||||
//STARTUP FINISHED READY TO SCREENSHOT
|
||||
Ready = true;
|
||||
return 0;
|
||||
@@ -228,13 +247,19 @@ namespace Test_Merge
|
||||
Bitmap result = new Bitmap(4242, 6969);
|
||||
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);
|
||||
MemoryStream stream = new MemoryStream(screenshotBytes);
|
||||
|
||||
result = new Bitmap(stream);
|
||||
result.Save(name + ".png");
|
||||
//result.Save(name + ".png");
|
||||
scrsht.SaveAsFile(name + ".png");
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user