Created
July 7, 2021 09:18
-
-
Save Jaimin180296/383fd784911bd6d84c9eae394ac5f2cc 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.By; | |
import org.openqa.selenium.JavascriptExecutor; | |
import org.openqa.selenium.WebDriver; | |
import org.openqa.selenium.WebElement; | |
import org.openqa.selenium.chrome.ChromeDriver; | |
import org.openqa.selenium.interactions.Actions; | |
import org.openqa.selenium.remote.DesiredCapabilities; | |
import org.openqa.selenium.remote.RemoteWebDriver; | |
import org.openqa.selenium.support.ui.ExpectedConditions; | |
import org.openqa.selenium.support.ui.WebDriverWait; | |
import org.testng.annotations.AfterTest; | |
import org.testng.annotations.BeforeClass; | |
import org.testng.annotations.Test; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
public class Doug { | |
static WebDriver driver; | |
final String AUTOMATE_USERNAME = ""; | |
final String AUTOMATE_ACCESS_KEY = ""; | |
final String URL = "http://" + AUTOMATE_USERNAME + ":" + AUTOMATE_ACCESS_KEY + "@hub-cloud.browserstack.com/wd/hub"; | |
@BeforeClass | |
public void setup() throws MalformedURLException { | |
DesiredCapabilities caps = new DesiredCapabilities(); | |
caps.setCapability("os_version", "9.0"); | |
caps.setCapability("device", "Samsung Galaxy Tab S6"); | |
caps.setCapability("real_mobile", "true"); | |
caps.setCapability("browserstack.local", "false"); | |
driver = new RemoteWebDriver(new URL(URL), caps); | |
} | |
@Test | |
public void test() throws InterruptedException { | |
driver.get("https://www.humancondition.com/"); | |
driver.findElement(By.xpath("//i[@class='fas fa-bars']")).click(); | |
JavascriptExecutor executor = (JavascriptExecutor) driver; | |
WebElement element = driver.findElement(By.xpath("//img[@alt='Google Play store image for WTM App']")); | |
executor.executeScript("arguments[0].click();", element); | |
Thread.sleep(5000); | |
} | |
@AfterTest | |
public void destroy() { | |
driver.quit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment