Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1. from appium import webdriver
  2.  
  3. caps = {}
  4. caps["platformName"] = "Android"
  5. caps["platformVersion"] = "5.1"
  6. caps["deviceName"] = "HUAWEI G9 plus"
  7. caps["automationName"] = "Appium"
  8. caps["app"] = "C:\\Users\\Will Turner\\Downloads\\snapchat.apk"
  9. caps["noReset"] = True
  10.  
  11. driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)
  12.  
  13. #basic snapchat functions, from snippits
  14.  
  15. #logout, must be at camera to use
  16. def logout():
  17. el1 = driver.find_element_by_id("com.snapchat.android:id/neon_header_profile_button_container")
  18. el1.click()
  19. driver.tap([(676, 64)]).perform()
  20. driver.press(x=378, y=976).move_to(x=11, y=-565).release().perform()
  21.  
  22.  
  23. driver.tap([(114, 1162)]).perform()
  24. el2 = driver.find_element_by_id("com.snapchat.android:id/yes_button")
  25. el2.click()
  26.  
  27. from appium import webdriver
  28. from time import sleep
  29.  
  30. #camera error shit
  31. #cameraError =
  32. if driver.find_element_by_id("android:id/message").is_displayed():
  33. cancelBtn = driver.find_element_by_id("android:id/button2")
  34. cancelBtn.click()
  35. else:
  36. pass
  37.  
  38. #betaWindow = driver.find_element_by_id("com.snapchat.android:id/yes_button")
  39. if driver.find_element_by_id("com.snapchat.android:id/yes_button").is_displayed():
  40. print("Beta window found, clicking yes..")
  41. driver.find_element_by_id("com.snapchat.android:id/yes_button").click()
  42. else:
  43. pass
  44.  
  45. # VARIABLES #
  46. # camera button is useless except for testing purposes since we're going to be posting photos from camera roll, etc.
  47. #cameraBtn = driver.find_element_by_accessibility_id("Take a snap, double tap and hold to take a video") # n\a
  48. #textBtn = driver.find_element_by_id("com.snapchat.android:id/vertical_tools_caption_btn") # text button for captions
  49. #clipBtn = driver.find_element_by_id("com.snapchat.android:id/vertical_tools_caption_btn") # button to attach links
  50. #sendToBtn = driver.find_element_by_id("com.snapchat.android:id/send_to_button") # button to send photos
  51. #saveBtn = driver.find_element_by_id("com.snapchat.android:id/save_button_complex_view") # button to save photos
  52. #exitBtn = driver.find_element_by_id("com.snapchat.android:id/preview_back_discard_button") # button to exit photo
  53.  
  54. profileBtn = driver.find_element_by_accessibility_id("Profile")
  55.  
  56. memoriesButton = driver.find_element_by_id("com.snapchat.android:id/nueva_nav_memories_icon")
  57.  
  58. def goToMemories():
  59. memoriesButton.click()
  60. sleep(10)
  61. def testSwipe():
  62. #yes i know this is fucking greasy and could make a loop but im lazy
  63. driver.press(x=348, y=855).move_to(x=0, y=-56).release().perform()
  64. sleep(3)
  65. goToMemories()
  66. testSwipe()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement