Created
October 28, 2021 16:56
-
-
Save Jaimin180296/75fb1c1808f3add6403ec9aea6dd806e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import org.openqa.selenium.*; | |
import org.openqa.selenium.remote.DesiredCapabilities; | |
import org.openqa.selenium.remote.RemoteWebDriver; | |
import org.openqa.selenium.support.ui.WebDriverWait; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
import java.util.HashMap; | |
public class AmazonNetworkLogs { | |
public static WebDriver driver; | |
public WebDriverWait wait; | |
public static String AUTOMATE_USERNAME = "username"; | |
public static String AUTOMATE_ACCESS_KEY = "password"; | |
public static final String URL = "https://" + AUTOMATE_USERNAME + ":" + AUTOMATE_ACCESS_KEY + "@hub-cloud.browserstack.com/wd/hub"; | |
public static void main(String[] args) throws InterruptedException, MalformedURLException { | |
DesiredCapabilities capabilities = new DesiredCapabilities(); | |
capabilities.setCapability("browserName", "Safari"); | |
capabilities.setCapability("browserVersion", "13.0"); | |
HashMap<String, Object> browserstackOptions = new HashMap<String, Object>(); | |
browserstackOptions.put("os", "OS X"); | |
browserstackOptions.put("osVersion", "Catalina"); | |
browserstackOptions.put("local", "false"); | |
browserstackOptions.put("seleniumVersion", "3.14.0"); | |
capabilities.setCapability("bstack:options", browserstackOptions); | |
HashMap<String, Boolean> networkLogsOptions = new HashMap<>(); | |
capabilities.setCapability("browserstack.networkLogs", "true"); | |
capabilities.setCapability("browserstack.networkLogsOptions", networkLogsOptions); | |
driver = new RemoteWebDriver(new URL(URL), capabilities); | |
driver.get("https://secure-ds.serving-sys-int.com/ClientTesting/Automation/StdBannerBabyShark/StdBannerHTTPS_TargetWindowCurrentFrameWithFrame.html"); | |
Thread.sleep(2000); | |
driver.switchTo().frame(1); | |
driver.switchTo().frame(0); | |
Thread.sleep(5000); | |
driver.findElement(By.xpath("//input[@id='Click']")).click(); | |
Thread.sleep(5000); | |
driver.quit(); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment