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
public void refreshTorIdentity(String userName) { | |
try (Socket socket = new Socket("127.0.0.1", 9151)) { | |
OutputStream output = socket.getOutputStream(); | |
String authenticationCommand = String.format("AUTHENTICATE \"%s\"\r\n", userName); | |
output.write(authenticationCommand.getBytes()); | |
output.write("SIGNAL NEWNYM\r\n".getBytes()); | |
InputStream input = socket.getInputStream(); | |
BufferedReader reader = new BufferedReader(new InputStreamReader(input)); | |
String line = reader.readLine(); |
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
@Test | |
public void open_tor_browser() { | |
driver.navigate().to("http://whatismyipaddress.com/"); | |
WebElement element = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='section_left']/div[2]"))); | |
Assert.assertNotEquals("151.80.16.169", element.getText()); | |
} |
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
private WebDriver driver; | |
private WebDriverWait wait; | |
private Process torProcess; | |
@BeforeClass | |
public void testSetup() throws IOException { | |
System.setProperty("webdriver.gecko.driver", "resources\\geckodriver.exe"); | |
String torBinaryPath = "C:\\Users\\aangelov\\Desktop\\Tor Browser\\Browser\\firefox.exe"; |
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
public class RunStandaloneChrome | |
{ | |
[FunctionName("RunStandaloneChrome")] | |
public IActionResult Run( | |
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, | |
ILogger logger) | |
{ | |
string result = "Nothing Happend"; | |
try | |
{ |
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
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. | |
FROM mcr.microsoft.com/azure-functions/dotnet:3.0 AS base | |
WORKDIR /home/site/wwwroot | |
EXPOSE 80 | |
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build | |
WORKDIR /src | |
COPY ["WebDriverTestsAzureFunctions/WebDriverTestsAzureFunctions.csproj", "WebDriverTestsAzureFunctions/"] | |
RUN dotnet restore "WebDriverTestsAzureFunctions/WebDriverTestsAzureFunctions.csproj" |
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
public class RunSauceLabsChrome | |
{ | |
[FunctionName("RunSauceLabsChrome")] | |
public IActionResult Run( | |
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, | |
ILogger logger) | |
{ | |
string result = "Nothing Happend"; | |
try | |
{ |
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
[TestMethod] | |
public void GoToWebSite() | |
{ | |
_driver.Navigate().GoToUrl("https://www.bing.com/"); | |
Console.WriteLine(_driver.PageSource); | |
Assert.IsTrue(_driver.PageSource.Contains("Bing")); | |
} |
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
private static AndroidDriver<AndroidElement> _driver; | |
[ClassInitialize] | |
public static void ClassInitialize(TestContext context) | |
{ | |
var appiumOptions = new AppiumOptions(); | |
appiumOptions.AddAdditionalCapability(MobileCapabilityType.BrowserName, "chrome"); | |
appiumOptions.AddAdditionalCapability("version", "mobile-79.0"); | |
appiumOptions.AddAdditionalCapability("enableVNC", true); | |
appiumOptions.AddAdditionalCapability("enableVideo", true); |
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
[TestMethod] | |
public void PerformActionsButtons() | |
{ | |
By byScrollLocator = new ByAndroidUIAutomator("new UiSelector().text(\"Views\");"); | |
var viewsButton = _driver.FindElement(byScrollLocator); | |
viewsButton.Click(); | |
var controlsViewButton = _driver.FindElementByXPath("//*[@text='Controls']"); | |
controlsViewButton.Click(); |
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
private static AndroidDriver<AndroidElement> _driver; | |
[ClassInitialize] | |
public static void ClassInitialize(TestContext context) | |
{ | |
var appiumOptions = new AppiumOptions(); | |
appiumOptions.AddAdditionalCapability("deviceName", "android"); | |
appiumOptions.AddAdditionalCapability("appPackage", "io.appium.android.apis"); | |
appiumOptions.AddAdditionalCapability("version", "6.0"); | |
appiumOptions.AddAdditionalCapability("appActivity", ".ApiDemos"); |