#-Begin-----------------------------------------------------------------
#-Includes------------------------------------------------------------
$Path = "C:\Program Files\Appium"
[Void][System.Reflection.Assembly]::LoadFrom($Path + "\appium-dotnet-driver.dll")
[Void][System.Reflection.Assembly]::LoadFrom($Path + "\Castle.Core.dll")
[Void][System.Reflection.Assembly]::LoadFrom($Path + "\Newtonsoft.Json.dll")
[Void][System.Reflection.Assembly]::LoadFrom($Path + "\WebDriver.dll")
[Void][System.Reflection.Assembly]::LoadFrom($Path + "\WebDriver.Support.dll")
#-Sub Main------------------------------------------------------------
Function Main() {
[OpenQA.Selenium.Remote.DesiredCapabilities]$Capabilities = `
[OpenQA.Selenium.Remote.DesiredCapabilities]::new();
$Capabilities.SetCapability([OpenQA.Selenium.Appium.Enums.MobileCapabilityType]::`
DeviceName, "emulator-5554");
$Capabilities.SetCapability([OpenQA.Selenium.Appium.Enums.MobileCapabilityType]::`
PlatformVersion, "8.1.0");
$Capabilities.SetCapability([OpenQA.Selenium.Appium.Enums.MobileCapabilityType]::`
PlatformName, "Android");
$Capabilities.SetCapability([OpenQA.Selenium.Appium.Enums.AndroidMobileCapabilityType]::`
AppPackage, "com.android.calculator2");
$Capabilities.SetCapability([OpenQA.Selenium.Appium.Enums.AndroidMobileCapabilityType]::`
AppActivity, "com.android.calculator2.Calculator");
[System.Uri]$Uri = [System.Uri]::new("http://127.0.0.1:4723/wd/hub");
$Driver = `
[OpenQA.Selenium.Appium.Android.AndroidDriver[OpenQA.Selenium.Appium.AppiumWebElement]]::`
new($Uri, $Capabilities);
If ($Driver -eq $null) {
Return;
}
$Driver.FindElementById("com.android.calculator2:id/digit_9").Click();
$Driver.FindElementById("com.android.calculator2:id/op_add").Click();
$Driver.FindElementById("com.android.calculator2:id/digit_6").Click();
$Driver.FindElementById("com.android.calculator2:id/eq").Click();
$Result = $Driver.FindElementById("com.android.calculator2:id/result").Text;
Write-Host "Das Ergebnis ist " $Result;
$Driver.FindElementByAccessibilityId("clear").Click();
$Driver.FindElementById("com.android.calculator2:id/digit_1").Click();
$Driver.FindElementById("com.android.calculator2:id/digit_6").Click();
$Driver.FindElementById("com.android.calculator2:id/digit_6").Click();
$Driver.FindElementByAccessibilityId("multiply").Click();
$Driver.FindElementById("com.android.calculator2:id/digit_9").Click();
$Driver.FindElementByAccessibilityId("equals").Click();
$Result = $Driver.FindElementById("com.android.calculator2:id/result").Text;
Write-Host "Das Ergebnis ist " $Result;
$Driver.CloseApp();
$Driver.Quit();
}
#-Main----------------------------------------------------------------
Main
#-End-------------------------------------------------------------------
#-Begin-----------------------------------------------------------------
#-Includes------------------------------------------------------------
$Path = "C:\Program Files\Appium"
[Void][System.Reflection.Assembly]::LoadFrom($Path + "\appium-dotnet-driver.dll")
[Void][System.Reflection.Assembly]::LoadFrom($Path + "\Castle.Core.dll")
[Void][System.Reflection.Assembly]::LoadFrom($Path + "\Newtonsoft.Json.dll")
[Void][System.Reflection.Assembly]::LoadFrom($Path + "\WebDriver.dll")
[Void][System.Reflection.Assembly]::LoadFrom($Path + "\WebDriver.Support.dll")
#-Sub Main------------------------------------------------------------
Function Main() {
[OpenQA.Selenium.Remote.DesiredCapabilities]$Capabilities = `
[OpenQA.Selenium.Remote.DesiredCapabilities]::new();
$Capabilities.SetCapability("deviceName", "emulator-5554");
$Capabilities.SetCapability("platformVersion", "8.1.0");
$Capabilities.SetCapability("browserName", "Chrome")
$Capabilities.SetCapability("platformName", "Android");
[System.Uri]$Uri = [System.Uri]::new("http://127.0.0.1:4723/wd/hub");
$Driver = `
[OpenQA.Selenium.Appium.Android.AndroidDriver[OpenQA.Selenium.Appium.AppiumWebElement]]::`
new($Uri, $Capabilities);
If ($Driver -eq $null) {
Return;
}
$Driver.Navigate().GoToUrl("https://www.google.de");
$Driver.FindElementByName("q").SendKeys("Selenium");
$Driver.FindElementByName("q").SendKeys([OpenQA.Selenium.Keys]::Enter);
Start-Sleep -Seconds 5
$Driver.CloseApp();
$Driver.Quit();
}
#-Main----------------------------------------------------------------
Main
#-End-------------------------------------------------------------------
"-Begin-----------------------------------------------------------------
REPORT Z_APPIUM.
DATA:
lo_posh TYPE REF TO zactivexposhv3,
lv_pscode TYPE string,
lv_result TYPE string,
lt_result TYPE STANDARD TABLE OF string
.
CREATE OBJECT lo_posh.
CHECK lo_posh->load_lib( ) = lo_posh->mc_true.
CHECK lo_posh->get_is_powershell_installed( ) = lo_posh->mc_true.
CHECK lo_posh->init( iv_load_profiles = lo_posh->mc_false ) = 0.
lo_posh->set_outputmode( lo_posh->mc_outputbuffer ).
lo_posh->set_outputwidth( 132 ).
lo_posh->clear_output( ).
lv_pscode = lo_posh->read_incl_as_string( iv_incl_name = 'Z_POSH_APPIUM_APP' ).
lo_posh->execute( lv_pscode ).
lv_result = lo_posh->get_outputstring( ).
lo_posh->clear_output( ).
lt_result = lo_posh->outputstring_to_table( iv_outputstring = lv_result ).
LOOP AT lt_result INTO lv_result.
WRITE: / lv_result.
ENDLOOP.
lo_posh->free_lib( ).
"-End-------------------------------------------------------------------
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |