-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
306 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...gic/Driver and Browser Management/Driver Creation Strategy/DebugDriverCreationStrategy.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using OpenQA.Selenium; | ||
using OpenQA.Selenium.Chrome; | ||
|
||
namespace PixaiBot.Business_Logic.Driver_and_Browser_Management.Driver_Creation_Strategy | ||
{ | ||
class DebugDriverCreationStrategy : IDriverCreationStrategy | ||
{ | ||
public IWebDriver CreateDriver() | ||
{ | ||
|
||
var driver = new ChromeDriver(); | ||
|
||
var service =ChromeDriverService.CreateDefaultService(); | ||
|
||
service.HideCommandPromptWindow = true; | ||
|
||
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); | ||
|
||
return driver; | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
.../Driver and Browser Management/Driver Creation Strategy/HeadlessDriverCreationStrategy.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using OpenQA.Selenium; | ||
using OpenQA.Selenium.Chrome; | ||
|
||
namespace PixaiBot.Business_Logic.Driver_and_Browser_Management.Driver_Creation_Strategy | ||
{ | ||
public class HeadlessDriverCreationStrategy : IDriverCreationStrategy | ||
{ | ||
public IWebDriver CreateDriver() | ||
{ | ||
var options = new ChromeOptions(); | ||
|
||
options.AddArgument("--headless"); | ||
|
||
var service = ChromeDriverService.CreateDefaultService(); | ||
|
||
service.HideCommandPromptWindow = true; | ||
|
||
var driver = new ChromeDriver(service, options); | ||
|
||
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); | ||
|
||
return driver; | ||
} | ||
|
||
|
||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...ic/Driver and Browser Management/Driver Creation Strategy/HiddenDriverCreationStrategy.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using OpenQA.Selenium; | ||
using OpenQA.Selenium.Chrome; | ||
|
||
namespace PixaiBot.Business_Logic.Driver_and_Browser_Management.Driver_Creation_Strategy | ||
{ | ||
class HiddenDriverCreationStrategy : IDriverCreationStrategy | ||
{ | ||
public IWebDriver CreateDriver() | ||
{ | ||
var options = new ChromeOptions(); | ||
|
||
options.AddArgument("--window-position=-32000,-32000"); | ||
|
||
|
||
var service = ChromeDriverService.CreateDefaultService(); | ||
|
||
service.HideCommandPromptWindow = true; | ||
|
||
var driver = new ChromeDriver(service, options); | ||
|
||
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); | ||
|
||
return driver; | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...s Logic/Driver and Browser Management/Driver Creation Strategy/IDriverCreationStrategy.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using OpenQA.Selenium; | ||
|
||
namespace PixaiBot.Business_Logic.Driver_and_Browser_Management.Driver_Creation_Strategy | ||
{ | ||
public interface IDriverCreationStrategy | ||
{ | ||
IWebDriver CreateDriver(); | ||
} | ||
} |
Oops, something went wrong.