本文整理汇总了C#中OpenQA.Selenium.Appium.Android.AndroidDriver类的典型用法代码示例。如果您正苦于以下问题:C# AndroidDriver类的具体用法?C# AndroidDriver怎么用?C# AndroidDriver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AndroidDriver类属于OpenQA.Selenium.Appium.Android命名空间,在下文中一共展示了AndroidDriver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunBeforeEach
public void RunBeforeEach()
{
server.respondToInit ();
DesiredCapabilities capabilities = new DesiredCapabilities();
AndroidDriver driver = new AndroidDriver(defaultUri, capabilities);
server.clear ();
}
示例2: StartingAndroidAppWithCapabilitiesAndServiceTest
public void StartingAndroidAppWithCapabilitiesAndServiceTest()
{
string app = Apps.get("androidApiDemos");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.SetCapability(MobileCapabilityType.DeviceName, "Android Emulator");
OptionCollector argCollector = new OptionCollector().AddArguments(GeneralOptionList.App(app))
.AddArguments(GeneralOptionList.AutomationName(AutomationName.Appium));
AppiumServiceBuilder builder = new AppiumServiceBuilder().WithArguments(argCollector);
AndroidDriver<AppiumWebElement> driver = null;
try
{
driver = new AndroidDriver<AppiumWebElement>(builder, capabilities);
driver.CloseApp();
}
finally
{
if (driver != null)
{
driver.Quit();
}
}
}
示例3: GetCurrentActivityTestCase
public void GetCurrentActivityTestCase()
{
AndroidDriver<IWebElement> driver = new AndroidDriver<IWebElement>(defaultUri, capabilities);
server.respondTo("GET", "/appium/device/current_activity", ".activities.PeopleActivity");
string activity = driver.CurrentActivity;
Assert.AreEqual(activity, ".activities.PeopleActivity");
}
示例4: GetAppStringsTestCase
public void GetAppStringsTestCase()
{
AndroidDriver driver = new AndroidDriver(defaultUri, capabilities);
var data = "21343n2312j3jw";
server.respondTo ("POST", "/appium/app/strings", data);
var result = driver.GetAppStrings ();
Assert.AreEqual (result, data);
}
示例5: EndTestCoverageTestCase
public void EndTestCoverageTestCase()
{
AndroidDriver driver = new AndroidDriver(defaultUri, capabilities);
var data = "21343n2312j3jw";
server.respondTo ("POST", "/appium/app/end_test_coverage", data);
var result = driver.EndTestCoverage ("android.intent.action.BOOT_COMPLETED", "/random/path");
Assert.AreEqual (result, data);
}
示例6: BeforeAll
public void BeforeAll()
{
DesiredCapabilities capabilities =
Caps.getAndroid19Caps(Apps.get("androidApiDemosLocal"));
Uri serverUri = AppiumServers.localURI;
driver = new AndroidDriver<AndroidElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
driver.Manage().Timeouts().ImplicitlyWait(Env.IMPLICIT_TIMEOUT_SEC);
}
示例7: InitBrowser
public void InitBrowser()
{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.SetCapability("deviceName", "AF2");
capabilities.SetCapability("app", "D:/BYTA/Framework/BYTA_AF_Framework_Task5/MobileTests/com.basecamp.bc3.apk");
capabilities.SetCapability("appPackage", "com.basecamp.bc3");
capabilities.SetCapability("appWaitActivity", "com.basecamp.bc3.activities.AuthChooserActivity");
capabilities.SetCapability("unicodeKeyboard", true);
driver = new AndroidDriver<IWebElement>(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities);
}
示例8: Main
static void Main(string[] args)
{
AndroidDriver<AndroidElement> driver;
var INIT_TIMEOUT_SEC = TimeSpan.FromSeconds(180);
var Capabilities=new DesiredCapabilities();
var serverUrl = new Uri("http://172.0.0.1:4723/wd/hub");
// Capabilities.SetCapability(CapabilityType.BrowserName,"");
Capabilities.SetCapability(MobileCapabilityType.DeviceName,"Android");
//Capabilities.SetCapability(MobileCapabilityType.AppActivity,"");
//Capabilities.SetCapability(MobileCapabilityType.AppPackage,"");
Capabilities.SetCapability(MobileCapabilityType.AppiumVersion, "1.4.13");
Capabilities.SetCapability(MobileCapabilityType.App,@"C:/sample-code/apps/ApiDemos-debug.apk");
driver=new AndroidDriver<AndroidElement>(serverUrl,Capabilities,INIT_TIMEOUT_SEC);
driver.Manage().Timeouts().ImplicitlyWait(INIT_TIMEOUT_SEC);
driver.FindElementByName("Graphics").Click();
driver.ScrollTo("FingerPaint", "android:id/list");
driver.FindElementByName("FingerPaint").Click();
AndroidElement element = driver.FindElementById("android:id/content");
Point point = element.Coordinates.LocationInDom;
Size size = element.Size;
driver.Swipe
(
point.X + 5,
point.Y + 5,
point.X + size.Width - 5,
point.Y + size.Height - 5,
200
);
driver.Swipe
(
point.X + size.Width - 5,
point.Y + 5,
point.X + 5,
point.Y + size.Height - 5,
2000
);
driver.FindElementByName("Graphics").Click();
driver.ScrollTo("OpenGL ES", "android:id/list").Click();
//driver.FindElementByName("OpenGL ES").Click();
driver.ScrollTo("Touch Rotate", "android:id/list").Click();
//driver.FindElementByName("TouchRotate").Click();
AndroidElement element1 = driver.FindElementById("android:id/content");
driver.Pinch(element1);
driver.Zoom(element1);
Thread.Sleep(2000);
driver.Quit();
}
示例9: Android
public Android (string deviceID,string package,string activity)
{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.SetCapability(CapabilityType.BrowserName, "");
capabilities.SetCapability(MobileCapabilityType.AppiumVersion, "1.0");
capabilities.SetCapability(MobileCapabilityType.PlatformVersion, "4.4.2");
capabilities.SetCapability(MobileCapabilityType.DeviceName, deviceID);
capabilities.SetCapability("autoLaunch", false);
capabilities.SetCapability(MobileCapabilityType.AppPackage, package);
capabilities.SetCapability(MobileCapabilityType.AppActivity, activity);
driver = new AndroidDriver<AppiumWebElement>(serverUri, capabilities, TimeSpan.FromSeconds(60));
}
示例10: beforeAll
public void beforeAll()
{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.SetCapability("deviceName", "Google Nexus 6 - 5.0.0 - API 21 - 1400x2560");
capabilities.SetCapability("platformName", "Android");
capabilities.SetCapability("app", AppPath);
_driver = new AndroidDriver<AppiumWebElement>(
new Uri(DeviceAddress),
capabilities);
}
示例11: BeforeAll
public void BeforeAll(){
DesiredCapabilities capabilities = Env.isSauce () ?
Caps.getAndroid501Caps (Apps.get ("androidApiDemos")) :
Caps.getAndroid19Caps (Apps.get ("androidApiDemos"));
if (Env.isSauce ()) {
capabilities.SetCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
capabilities.SetCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
capabilities.SetCapability("name", "android - simple");
capabilities.SetCapability("tags", new string[]{"sample"});
}
Uri serverUri = Env.isSauce () ? AppiumServers.sauceURI : AppiumServers.LocalServiceURIAndroid;
driver = new AndroidDriver<AndroidElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
driver.Manage().Timeouts().ImplicitlyWait(Env.IMPLICIT_TIMEOUT_SEC);
}
示例12: BeforeAll
public void BeforeAll()
{
DesiredCapabilities capabilities = Env.isSauce () ?
Caps.getAndroid18Caps (Apps.get ("selendroidTestApp")) :
Caps.getAndroid19Caps (Apps.get ("selendroidTestApp"));
if (Env.isSauce ()) {
capabilities.SetCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
capabilities.SetCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
capabilities.SetCapability("name", "android - webview");
capabilities.SetCapability("tags", new string[]{"sample"});
}
Uri serverUri = Env.isSauce () ? AppiumServers.sauceURI : AppiumServers.localURI;
driver.Manage().Timeouts().ImplicitlyWait(Env.IMPLICIT_TIMEOUT_SEC);
driver = new AndroidDriver<IWebElement>(capabilities);
}
示例13: BeforeAll
public void BeforeAll()
{
DesiredCapabilities capabilities = Env.isSauce() ?
Caps.getAndroid18Caps(Apps.get("selendroidTestApp")) :
Caps.getAndroid19Caps(Apps.get("selendroidTestApp"));
if (Env.isSauce())
{
capabilities.SetCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
capabilities.SetCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
capabilities.SetCapability("tags", new string[] { "sample" });
}
Uri serverUri = Env.isSauce() ? AppiumServers.sauceURI : AppiumServers.localURI;
driver = new AndroidDriver<AppiumWebElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
pageObject = new AndroidJavaScriptTestPageObject(driver);
driver.StartActivity("io.selendroid.testapp", ".WebViewActivity");
}
示例14: Inisialized
public void Inisialized()
{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.SetCapability("deviceName", "Nexus 5");
capabilities.SetCapability("platformName", "Android");
capabilities.SetCapability("app", @"C:\Users\Administrator\AppData\Roaming\Skype\My Skype Received Files\purevpn-release.apk");
capabilities.SetCapability("platformVersion", "4.4");
capabilities.SetCapability("appPackage", "com.gaditek.purevpnics");
// capabilities.SetCapability("appPackage", "com.gaditek.purevpnics.main.SplashActivity");
// capabilities.SetCapability("appActivity", "com.gaditek.purevpnics.main.MainActivity");
capabilities.SetCapability("appActivity", "com.gaditek.purevpnics.main.AuthActivity");
// WebDriverWait wait = new WebDriverWait(driver, 10);
driver = new AndroidDriver<AppiumWebElement>(new Uri("http://127.0.0.1:8082/wd/hub"), capabilities);
}
示例15: BeforeAll
public void BeforeAll()
{
DesiredCapabilities capabilities =
Caps.getSelendroid16Caps(Apps.get("selendroidTestApp"));
if (Env.isSauce())
{
capabilities.SetCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
capabilities.SetCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
capabilities.SetCapability("name", "android - complex");
capabilities.SetCapability("tags", new string[] { "sample" });
}
Uri serverUri = Env.isSauce() ? AppiumServers.sauceURI : AppiumServers.localURI;
driver = new AndroidDriver<AppiumWebElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
TimeOutDuration timeSpan = new TimeOutDuration(new TimeSpan(0, 0, 0, 5, 0));
pageObject = new AndroidPageObjectChecksSelendroidModeOnNativeApp();
PageFactory.InitElements(driver, pageObject, new AppiumPageObjectMemberDecorator(timeSpan));
}