Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Jaimin180296/3bf85edbd87fdc86d0ccd933f070f8cb to your computer and use it in GitHub Desktop.
Save Jaimin180296/3bf85edbd87fdc86d0ccd933f070f8cb to your computer and use it in GitHub Desktop.
import io.appium.java_client.ios.IOSDriver;
import org.openqa.selenium.*;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.interactions.touch.TouchActions;
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 java.net.URL;
public class KeyboardTesting {
public static final String AUTOMATE_USERNAME = "jaiminmehta3";
public static final String AUTOMATE_ACCESS_KEY = "AfSweJK2YK3z5sW1xRSr";
public static final String URL = "https://" + AUTOMATE_USERNAME + ":" + AUTOMATE_ACCESS_KEY + "@hub-cloud.browserstack.com/wd/hub";
public static void main(String[] args) throws Exception {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("os_version", "14");
caps.setCapability("real_mobile", "true");
caps.setCapability("device", "iPhone XS");
caps.setCapability("browserstack.appium_version", "1.19.1");
caps.setCapability("browserstack.local", "false");
caps.setCapability("browserstack.networkLogs", "false");
caps.setCapability("browserstack.selenium_version", "3.141.59");
caps.setCapability("nativeWebTap", "true");
caps.setCapability("name", "KeyBoard"); // test name
caps.setCapability("build", "iOS keyBoard"); // CI/CD job or build name
WebDriver driver = new RemoteWebDriver(new URL(URL), caps);
WebDriverWait wait = new WebDriverWait(driver, 30);
driver.get("https://qa-1.sg.carouselltech.com/");
driver.findElement(By.xpath("//p[text()='Login']")).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@name='username']"))).click();
Thread.sleep(3000);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@name='username']"))).sendKeys("caroutest_beverly1626369714");
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@name='password']"))).sendKeys("PUypOuU");
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//button[text()='Log in']"))).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[local-name()='svg' and @class='M_vB']"))).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[contains(text(),'Rustic Bronze Wallet')]"))).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//button[text()='Edit offer']"))).click();
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@type='number']"))).click();
Thread.sleep(5000);
WebElement offers = driver.findElement(By.xpath("//button[@class='M_rP M_sc M_rS M_iC']"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", offers);
Thread.sleep(5000);
WebElement click= wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//textarea[@placeholder='Type here...']")));
executor.executeScript("arguments[0].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