Run automations on mobiles.
Example
python -m AppiumConcepts.LaunchMultipleApps.LaunchMultiApp
python -m LoggingConcepts.loggingPy.LoggingDemo.py
pytest -n auto PyTestConcepts.pytest_parallel
For Android devices: - AndroidDrivers - basics - ElementActions - ElementProperties - gestures - hybrid - locators - ResetStrategies - Waits For IOS devices: - IosAutomation
Run {browser}://inspect/#devices
p.e. in chrome:
chrome://inspect/#devices
`python -m <foder/module name>.
Example:
python -m basics.GalaxyLaunchApp
adb shell pm list packages | grep telus # List pkgs
adb shell pm dump com.telus.myaccount.dev | grep -A 1 MAIN # List main activities
- Open the app in the connected device
- Run
$ adb devices
$ adb shell
dm1q:/ $ dumpsys window displays | grep -E "mCurrentFocus"
mCurrentFocus=null
mCurrentFocus=Window{f1f80ed u0 com.android.vending/com.android.vending.AssetBrowserActivity}
$ adb shell dumpsys window windows | grep imeLayeringTarget
imeLayeringTarget in display# 0 Window{9364929 u0 com.android.vending/com.android.vending.AssetBrowserActivity}
- 7 double click on build number, locater in settings>>about phone>sw information>>build number
- A pop up telling that developer mode is now activated will appear.
- Go back and at the same level of about phone, a new option will appears “developer options”
- Toggle on usb debugging
- Toggle on pointer location
pip install allure-pytest
brew install allure
Then update the $path variable
open ~/.zshrc
and add export PATH="/opt/homebrew/opt/allure/bin:$PATH"
adb shell pm list packages | grep telus
adb shell pm path com.telus.myaccount
adb pull /data/app/~~aHsb5YrjVeaiKULpAmze6Q==/com.telus.myaccount-OXam2EiFYj7xDu3l3KZxkQ==/base.apk
- Innstall Flake8 plugin in VSCode
- Add flake8 and black to environment
pip install black
pip install flake8
Then you can run
black model.py
flake8 model.py
- Android Key Codes
- Send return key for iOS Appium python
- Appium Mobile Driver Desired Capabilities
- selenium.common.exceptions
- selenium.webdriver.support.expected_conditions
- Behave Documentation Tutorial
- Allow or deny all permissions for iOS apps
- Unable to use Selenium Webdriver. Getting two exceptions
If the Selenium version you are using is v4.6.0 or above, then you don't really have to set the driver.exe path. Selenium can handle the browser and drivers by itself. (Current selenium==4.15.2)
- Could not create a session: You must enable 'Allow remote automation' in the Developer section of Safari Settings to control Safari via WebDriver.
On MacBook Pro (Apple M2 Pro) ▪ select Safari ▪ Select Setting ▪ Select “Advanced” tab ▪ Check “Show features for web developers” ▪ Now you see “develop” option is on the MacOS menu ⁃ select develop ⁃ Select “Developer settings…” ⁃ check “Allow remote automation” Now you can run your tests against safari
- Look for
firefox,geckodriverin homebrew page. - Run
brew install --cask firefox - Runn
brew install geckodriver
pip install behave
pip install allure-behave
Generate reports
behave -f allure_behave.formatter.AllureFormatter -o %allure_result_folder% ./features
allure serve "logs_path"
```
brew install jenkins
```
Output: ``` Caveats Note: When using launchctl the port will be 8080.
To start jenkins now and restart at login:
brew services start jenkins
Or, if you don't want/need a background service you can just run:
/opt/homebrew/opt/jenkins/bin/jenkins --httpListenAddress\=127.0.0.1 --httpPort\=8080
==> Summary
🍺 /opt/homebrew/Cellar/jenkins/2.491: 9 files, 95.6MB
==> Running `brew cleanup jenkins`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Caveats
==> jenkins
Note: When using launchctl the port will be 8080.
To start jenkins now and restart at login:
brew services start jenkins
Or, if you don't want/need a background service you can just run:
/opt/homebrew/opt/jenkins/bin/jenkins --httpListenAddress\=127.0.0.1 --httpPort\=8080
```
To start jenkins now and restart at login:
brew services start jenkins
Or, if you don't want/need a background service you can just run:
/opt/homebrew/opt/jenkins/bin/jenkins --httpListenAddress\=127.0.0.1 --httpPort\=8080
```
where jenkins
```
```
jenkins --version
```
```
/opt/homebrew/var/log/jenkins
```
```
/Users/j.escalante/.jenkins/secrets/initialAdminPassword
```
- Prerrequisites
- Full Access on Terminal
- Settings >> Privacy & Security >> Full Disk Access >> Terminal Toggled On
- Full Access on Terminal
- New Item
- Named
PythonTestAutomation - Select
FreeStyle Project - Click
OkBtn - Click on
AdvanceBtn - Scroll down and click on
Use Custom Workspacecheckbox - Set the directory path to the project (SeleniumFramework):
/Users/j.escalante/Documents/Courses/Appium-Python - Scroll down until
Buildsection - Click on
Add build stepdropdown menu - Select
Execute Shelloption - Enter the command to execute:
source /Users/j.escalante/.zshrc conda activate appium pytest -v -s --alluredir SeleniumFramework/reports/allurereports/ SeleniumFramework/tests/TestSuitRegression.py - Click on
Savebtn - Click on
Build Nowmenu option (left menu)
- Enter to http://localhost:8080/
- Select the automation
- Click on
Configuration(left menu) - Scroll until
TriggerSection - Click on
Build periodicallycheckbox - Add the cronjob schedule, ex.
H 9 * * 1-5(at 9:00am from Monday to Friday) - Click on
ApplyandSavebtns.
Site: https://app.saucelabs.com/ Documentation: sauce:visual Capability Options
Steps:
- Create account
- Go to user settings, scroll until Get Access key and save it with the user name and ondemand url. From the url, we need to remove user and pwd as they are configured apart.
- Review browsee supported
- Go to https://saucelabs.com/
- Menu Products >> Supported Browser & Devices
- Scroll until
>> See Platform Configurator <<btn - Click on it
- Play with the desired configuration, MAC-CHROME-PYTHON-SELENIUM 4
- Copy sample configuration to apply to your automation
- Run locally the adapted file
python -m SeleniumConcepts.SouceLabSample.SauceLabTest1 - Go to https://app.saucelabs.com/ >> Automated >> Test Results
TouchAction().press(el0).moveTo(el1).release()
List the devices >> xcrun simctl list
List the active devices >> xcrun simctl list | grep Booted
List all of the installed applications on the Simulator
xcrun simctl listapps {DEVICE_UUID} | grep myapp # com.myapp.myaccount
uninstall an app:
xcrun simctl uninstall booted com.myapp.myaccount
Run
xcrun xctrace list devices
Output expected:
== Devices ==
MBSVLCDISHPH65T (1F3E8F96-94B7-5203-A0FB-493767537E4E)
Jacqueline Escalante’s iPhone (18.2.1) (00008120-001969A03AC2601E)
== Simulators ==
Apple Watch SE (40mm) (2nd generation) Simulator (11.2) (38157A4D-1A61-474B-BF2C-6F836814FC89)
Apple Watch SE (44mm) (2nd generation) Simulator (11.2) (1514E11E-9170-4790-990C-7F04AB919F1E)
...
For device, udid = 00008120-001969A03AC2601E
On the bar icon on the left side, click on the last icon related to build log The log will appear, and copy the path showed there
/Users/j.escalante/Library/Developer/Xcode/DerivedData/UIKitCatalog-gpjtxvrioqhghccuvfvxwtwwizdc/Build/Products/Debug-iphoneos/UIKitCatalog.app
Source:
https://stackoverflow.com/questions/33790957/unable-to-click-on-a-button-link-on-mobile-view-ios-via-appium-using-capybara Problem: Click button does not open the window because Safari blocked it Solution: Change configuration in Safari. Steps:
- Go to iphone settings
- Under general part, turn off "Block pop-ups"
From android:
adb shell 'settings get secure android_id'
adb -s <YOUR-DEVICE-ID> shell getprop # device id is got from adb devices
From iOS:
- Initiate iTunes/Music and connect your device.
- Go to Devices and select your device by clicking on it.
- Click on 'serial number.
- Your 'serial number' will automatically change to your UDID.
- Click on the 'Edit' icon, then 'Copy'
- ‘Paste’ the same (taken from iTunes menu) into your email. The email message will display your UDID.