Skip to content

Instantly share code, notes, and snippets.

View bbchriscesar's full-sized avatar
🏠
Working from home

Christianne Cesar bbchriscesar

🏠
Working from home
View GitHub Profile
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch();
const context = await browser.newContext();
// Enable network request interception
await context.route('**/*', (route, request) => {
// Intercept the network request
console.log(`Intercepted: ${request.url()}`);
@bbchriscesar
bbchriscesar / scan_and_delete.bat
Created April 4, 2023 16:41
This Windows batch script will scan a given directory and permanently delete any files or subdirectories found without warning. If no files or subdirectories are found, the script will simply exit without taking any action.
@echo off
set dir_path=C:\Example\Directory
if not exist "%dir_path%" (
echo Directory does not exist.
exit /b
)
echo Scanning directory "%dir_path%"...
@bbchriscesar
bbchriscesar / install_apk.cmd
Created April 4, 2023 10:41
This Windows batch script is designed to scan a directory for APK files and install them via ADB. The script was particularly helpful to me in a CI/CD setup.
@echo off
set "dir=C:\path\to\APK\files"
for /r "%dir%" %%i in (*.apk) do (
set "filename=%%~nxi"
goto install
)
echo No APK files found in %dir%
goto end
:install
import os
from time import sleep
# os.system("start /B start cmd.exe @cmd /k appium")
os.system("start /B start cmd.exe @cmd /k appium -a 127.0.0.1 -p 4728")
sleep(8)
os.system("taskkill /F /IM node.exe")
os.system("taskkill /F /IM cmd.exe")
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import os
import time
mobile_emulation = {
"deviceMetrics": { "width": 411, "height": 731, "pixelRatio": 3.0 },
"userAgent": "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19" } # For LINUX
#"userAgent": "mobile web mac : "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36" } # For MAC
#!/bin/bash
## declare an array variable
## declare -a arr=("element1" "element2" "element3")
local=(ja)
#local=(pt-BR pt-PT ru th tr vi zh-TW)
function switchLocal(){
adb shell am broadcast -a com.google.android.testing.i18n.localeswitcher.CHANGE_LOCALE -e LANGUAGE_TAG "$1"
}
import pytest
from appium import webdriver
import time
@pytest.mark.parametrize("udid, systemPort", [
("FA7BN1A04058", "8201"),
("FA7BN1A04086", "8202")
]
)
def test_SettingsTestCase(udid, systemPort):
from appium import webdriver
import time
import os.path
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
xpath = By.XPATH
id = By.ID
css = By.CSS_SELECTOR
import os
import time
udid = '99SAY1BJFV'
filename = 'videoRecord'
def startRecord(filename):
adb = 'adb -s ' + udid + ' shell screenrecord /sdcard/' + filename + '.mp4'
os.system(adb)
from appium import webdriver
import os.path
import time
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from appium.webdriver.common.touch_action import TouchAction
xpath = By.XPATH
id = By.ID