using OpenQA.Selenium;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Support.UI;
using System;
using System.Threading;
namespace AppiumTests {
public class RecordedTest {
static void Main(string[] args) {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.SetCapability("browserName", "iOS");
capabilities.SetCapability("platform", "Mac");
capabilities.SetCapability("version", "6.1");
capabilities.SetCapability("app", "/Users/mac_hy/Library/Developer/Xcode/DerivedData/ZDPrometheus-eanlmixqosrcqbaqvpsbixofcqto/Build/Products/Debug-iphonesimulator/guest.app");
RemoteWebDriver wd = new RemoteWebDriver(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities);
try {
wd.Click(By.Xpath("//window[1]/image[3]"));
wd.Click(By.Xpath("//window[1]/image[3]"));
wd.Click(By.Name("tabbar item unselected 01"));
wd.FindElement(By.Name("手机号码")).SendKeys("131012345678");
// 131012345678
wd.FindElement(By.Xpath("//window[1]/textfield[1]")).SendKeys("131012345678");
wd.FindElement(By.Xpath("//window[1]/secure[1]")).SendKeys("123456");
wd.Click(By.Xpath("//window[1]/button[7]"));
wd.Click(By.Xpath("//window[1]/scrollview[1]"));
wd.ExecuteScript("mobile: swipe", new Dictionary<string, double>() { { "touchCount", 1 }, { "startX", 59 }, { "startY", 286 }, { "endX", 70 }, { "endY", 297 }, { "duration", 0.9494141 } });
wd.Click(By.Xpath("//window[1]/text[1]"));
wd.Click(By.Name("apply business dropdown arrow "));
wd.Click(By.Xpath("//window[1]/tableview[1]/cell[2]/button[1]"));
wd.FindElement(By.Xpath("//window[1]/textfield[1]")).SendKeys("13101234567");
wd.Click(By.Name("apply business button submit"));
wd.SwitchTo().Alert().Accept();
wd.Click(By.Xpath("//window[4]/alert[1]/text[1]"));
wd.Click(By.Name("确定"));
wd.Click(By.Name("tabbar item unselected 01"));
wd.Click(By.Name("注册"));
wd.FindElement(By.Xpath("//window[1]/textfield[1]")).SendKeys("18321333675");
wd.Click(By.Name("sign up agreement button"));
wd.ExecuteScript(" ", null);
wd.ExecuteScript("用户协议", null);
wd.Click(By.Name("navigation bar button back"));
wd.Click(By.Name("sign up agreement button unsel"));
wd.Click(By.Name("发送验证码"));
wd.FindElement(By.Xpath("//window[1]/textfield[1]")).SendKeys("804592");
wd.FindElement(By.Name("(null)")).SendKeys("804592");
wd.FindElement(By.Xpath("//window[1]/secure[1]")).SendKeys("123456");
wd.FindElement(By.Xpath("//window[1]/secure[2]")).SendKeys("123456");
wd.Click(By.Xpath("//window[1]/button[2]"));
} finally { wd.Quit(); }
}
public static bool isAlertPresent(IWebDriver wd) {
try {
wd.SwitchTo().Alert();
return true;
} catch (NoAlertPresentException e) {
return false;
}
}
}
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Support.UI;
using System;
using System.Threading;
namespace AppiumTests {
public class RecordedTest {
static void Main(string[] args) {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.SetCapability("browserName", "iOS");
capabilities.SetCapability("platform", "Mac");
capabilities.SetCapability("version", "6.1");
capabilities.SetCapability("app", "/Users/mac_hy/Library/Developer/Xcode/DerivedData/ZDPrometheus-eanlmixqosrcqbaqvpsbixofcqto/Build/Products/Debug-iphonesimulator/guest.app");
RemoteWebDriver wd = new RemoteWebDriver(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities);
try {
wd.Click(By.Xpath("//window[1]/image[3]"));
wd.Click(By.Xpath("//window[1]/image[3]"));
wd.Click(By.Name("tabbar item unselected 01"));
wd.FindElement(By.Name("手机号码")).SendKeys("131012345678");
// 131012345678
wd.FindElement(By.Xpath("//window[1]/textfield[1]")).SendKeys("131012345678");
wd.FindElement(By.Xpath("//window[1]/secure[1]")).SendKeys("123456");
wd.Click(By.Xpath("//window[1]/button[7]"));
wd.Click(By.Xpath("//window[1]/scrollview[1]"));
wd.ExecuteScript("mobile: swipe", new Dictionary<string, double>() { { "touchCount", 1 }, { "startX", 59 }, { "startY", 286 }, { "endX", 70 }, { "endY", 297 }, { "duration", 0.9494141 } });
wd.Click(By.Xpath("//window[1]/text[1]"));
wd.Click(By.Name("apply business dropdown arrow "));
wd.Click(By.Xpath("//window[1]/tableview[1]/cell[2]/button[1]"));
wd.FindElement(By.Xpath("//window[1]/textfield[1]")).SendKeys("13101234567");
wd.Click(By.Name("apply business button submit"));
wd.SwitchTo().Alert().Accept();
wd.Click(By.Xpath("//window[4]/alert[1]/text[1]"));
wd.Click(By.Name("确定"));
wd.Click(By.Name("tabbar item unselected 01"));
wd.Click(By.Name("注册"));
wd.FindElement(By.Xpath("//window[1]/textfield[1]")).SendKeys("18321333675");
wd.Click(By.Name("sign up agreement button"));
wd.ExecuteScript(" ", null);
wd.ExecuteScript("用户协议", null);
wd.Click(By.Name("navigation bar button back"));
wd.Click(By.Name("sign up agreement button unsel"));
wd.Click(By.Name("发送验证码"));
wd.FindElement(By.Xpath("//window[1]/textfield[1]")).SendKeys("804592");
wd.FindElement(By.Name("(null)")).SendKeys("804592");
wd.FindElement(By.Xpath("//window[1]/secure[1]")).SendKeys("123456");
wd.FindElement(By.Xpath("//window[1]/secure[2]")).SendKeys("123456");
wd.Click(By.Xpath("//window[1]/button[2]"));
} finally { wd.Quit(); }
}
public static bool isAlertPresent(IWebDriver wd) {
try {
wd.SwitchTo().Alert();
return true;
} catch (NoAlertPresentException e) {
return false;
}
}
}