def test_(self): desired_caps = Desired_Capabilities.startdevices() self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) sleep(5) print u'设备配置成功' #点击头像登录 go_login =self.driver.find_element_by_id('com.manboker.headportrait:id/entry_album_set') go_login.click() sleep(5) click_head_portrait = self.driver.find_element_by_id('com.manboker.headportrait:id/set_log_out') click_head_portrait.click() login = self.driver.find_element_by_name("其他登录方式") login.click() #输入用户名 username = self.driver.find_element_by_name("手机号码/邮箱") username.send_keys("13215998390") #输入密码 possword = self.driver.find_element_by_id('com.manboker.headportrait:id/login_password') possword.send_keys("123456") # driver.press_keycode(4) #点击登录按钮 login_btn = self.driver.find_element_by_id("com.manboker.headportrait:id/login_submit") login_btn.click() sleep(2)
def setUp(self): desired_caps = Desired_Capabilities.startdevices() self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) print u'设备配置成功' time.sleep(5)
def setUp(self): desired_caps = Desired_Capabilities.startdevices() self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) self.driver.implicitly_wait(10) print u'设备配置成功' sleep(10)
def setUp(self): desired_caps = Desired_Capabilities.startdevices() self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) print u"设备配置成功" sleep(10) enter_makecomic = self.driver.find_elements_by_class_name("android.view.View") enter_makecomic[0].click() sleep(8) self.driver.find_element_by_name("美妆").click() # 进入美妆 sleep(10)
def setUp(self): desired_caps = Desired_Capabilities.startdevices() self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) print u"设备配置成功" sleep(10) enter_makecomic = self.driver.find_elements_by_class_name( "android.view.View") enter_makecomic[0].click() sleep(8) AppMethon.CreateDir('\Test') AppMethon.CreateDir('\TestMulticolor')
def SetUp(self): desired_caps = Desired_Capabilities.startdevices() self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) print u"设备配置成功" sleep(5) homeDshang = self.driver.find_elements_by_class_name( "android.view.View") homeDshang[1].click() sleep(8) print self.driver.page_source print self.driver.context self.driver.switch_to.context("WEBVIEW_com.android.browser")
def start(self): desired_caps = Desired_Capabilities.startdevices() self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) sleep(5) print u'设备配置成功' # def close(self): # self.driver.quit() print u'进入首页了----' make_commic = self.driver.find_elements_by_class_name( "android.view.View") make_commic[0].click() sleep(5) commit_btn = self.driver.find_element_by_id( "com.manboker.headportrait:id/commit_btn") commit_btn.click() sleep(2) self.driver.get_screenshot_as_file( 'C:\Pycharm\Manboker\ComicInfoPage\screenshot' + '.jpg') print u'开始评分' star_rating = self.driver.find_elements_by_class_name( "android.widget.ImageView") star_rating[4].click() sleep(1.5) # 打标签 tag = self.driver.find_element_by_name("加标签") tag.click() print u'添加后删除标签' add_tag = self.driver.find_element_by_id( "com.manboker.headportrait:id/add_tag_et") add_tag.click() add_tag.send_keys("addtag") self.driver.find_element_by_name("添加").click() sleep(1) delete_tag = self.driver.find_element_by_name("addtag") delete_tag.click() sleep(1) confirm_delete_tag = self.driver.find_element_by_id( "android:id/button1") confirm_delete_tag.click() sleep(1) self.driver.find_element_by_id( "com.manboker.headportrait:id/add_tag_btn_back").click() sleep(2) print u"添加感受" sleep(5) add_feeling = self.driver.find_element_by_id( "com.manboker.headportrait:id/add_feeling_et") add_feeling.click() add_feeling.send_keys("testfeeling") self.driver.find_element_by_id( "com.manboker.headportrait:id/comic_add_feeling_btn").click() sleep(5) favorite = self.driver.find_element_by_id( "com.manboker.headportrait:id/comit_praise_btn") favorite.click() sleep(2) title_hot = self.driver.find_element_by_id( "com.manboker.headportrait:id/comic_info_comit_title_hot_btn") title_hot.click() sleep(1) #向下滑动刷新屏幕 print u'下来刷新感受' self.driver.swipe(1137, 450, 1137, 649, 1000) sleep(1) print u'检查完成---------'