Direkt zum Inhalt

Change device orientation Landscape and Portrait in Appium Robot Framework

0

Im using Appium Robot framework and wanted to know how i can change the device orientation for iOS and Android devices in device farm, Is there any support provided by device farm to test it. I saw that when accessing the device farm devcie remotely there's an option , but when running the automation tests by creating new run and submitting all the artifacts "APPIUM PYTHON", there's no configuration present to change the device orientation

gefragt vor 3 Monaten25 Aufrufe
1 Antwort
0

When running Appium tests in AWS Device Farm, you can change device orientation programmatically within your Appium Robot Framework tests rather than through Device Farm configuration.

For both iOS and Android devices, you can use Appium's capabilities to control device orientation by adding commands in your test script. Here's how you can implement this in your Robot Framework tests:

*** Keywords ***
Set Device Orientation To Landscape
Execute Driver Script    driver.orientation = "LANDSCAPE"

Set Device Orientation To Portrait
Execute Driver Script    driver.orientation = "PORTRAIT"

You can also fine-tune your Appium server parameters in Device Farm by adjusting the default Appium capabilities in your test spec file. For example, you could include orientation-related capabilities in your pre_test phase:

phases:
pre_test:
- # Start up Appium with custom capabilities
- >-
appium --log-timestamp
--default-capabilities "{\"deviceName\": \"$DEVICEFARM_DEVICE_NAME\", 
\"platformName\":\"$DEVICEFARM_DEVICE_PLATFORM_NAME\", 
\"app\":\"$DEVICEFARM_APP_PATH\",
\"automationName\":\"XCUITest\", 
\"udid\":\"$DEVICEFARM_DEVICE_UDID_FOR_APPIUM\", 
\"platformVersion\":\"$DEVICEFARM_DEVICE_OS_VERSION\"}"
>> $DEVICEFARM_LOG_DIR/appiumlog.txt 2>&1 &

Remember that while the remote access interface provides UI controls for changing orientation, for automated tests you need to implement the orientation changes directly in your test code using Appium commands.
Sources
Speeding up Appium-based tests in Device Farm through desired capabilities - AWS Device Farm
Extending custom test environments in Device Farm - AWS Device Farm

beantwortet vor 3 Monaten
  • Getting error 'No keyword with name 'Execute Driver Script' found.', is the above solution correct

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.