-
Notifications
You must be signed in to change notification settings - Fork 0
/
main2.py
69 lines (61 loc) · 2.52 KB
/
main2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import time
from appium import webdriver
from appium.webdriver.common.touch_action import TouchAction
desired_cap = {
"platformName": "Android",
"appActivity": "com.atg.world.activity.SplashActivity",
"appWaitDuration": "5000",
"appExecTimeout": "5000",
"uiautomator2ServerLaunchTimeout": "50000",
"uiautomator2ServerInstallTimeout": "50000",
"appPackage": "com.ATG.World",
"deviceName": "your device",
"driver": "http://localhost:4723/wd/hub",
"app ": "D:\\Programming\\Appium-APKs",
}
driver = webdriver.Remote("http://localhost:4723/wd/hub", desired_cap)
driver.implicitly_wait(30)
def test_LoginWithRightCredential():
driver.find_element_by_id("com.ATG.World:id/getStartedTv").click()
driver.find_element_by_id("com.ATG.World:id/login_email").click()
email = driver.find_element_by_id("com.ATG.World:id/email")
email.send_keys("wiz_saurabh@rediffmail.com")
password = driver.find_element_by_id("com.ATG.World:id/password")
password.send_keys("Pass@123")
signin = driver.find_element_by_id("com.ATG.World:id/email_sign_in_button")
signin.click()
print("test_LoginWithRightCredential passed")
test_LoginWithRightCredential()
time.sleep(3)
TouchAction(driver).tap(None, 221, 1122).perform()
time.sleep(3)
TouchAction(driver).tap(None, 228, 1303).perform()
time.sleep(3)
TouchAction(driver).tap(None, 716, 2185).perform()
time.sleep(3)
TouchAction(driver).tap(None, 944, 966).perform()
time.sleep(3)
driver.find_element_by_id(
"com.android.permissioncontroller:id/permission_allow_foreground_only_button"
).click()
time.sleep(3)
driver.find_element_by_id(
"com.android.permissioncontroller:id/permission_allow_button"
).click()
Btn = driver.find_element_by_xpath(
"/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/androidx.appcompat.widget.LinearLayoutCompat/android.widget.FrameLayout/android.widget.ListView/android.widget.TextView[1]"
)
TouchAction(driver).tap(None, 626, 1277).perform()
time.sleep(3)
TouchAction(driver).tap(None, 300, 561).perform()
time.sleep(3)
TouchAction(driver).tap(None, 300, 561).perform()
time.sleep(3)
TouchAction(driver).tap(None, 181, 597).perform()
time.sleep(3)
TouchAction(driver).tap(None, 1284, 224).perform()
time.sleep(3)
caption = driver.find_element_by_id("com.ATG.World:id/postCaption")
caption.send_keys("test").click()
driver.find_element_by_id("com.ATG.World:id/toolbar_post_action").click()
print("Image succesffuly posted to ATG world!")