def clickSearchRadio(self): print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) element = pm.find_element_by_id( self, id="com.archermind.saic.radio:id/btn_radio_amfm_search") print("Click SearchRadio") pm.click_by_element(self, element=element) print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) while True: if pm.find_element_by_id( self, id= "com.archermind.saic.radio:id/btn_radio_scan_dialog_cancel" ).exists(): time.sleep(5) # 等待搜台 print("sleep 5s") else: print("Finish Serach ") break if pm._find_element_by_text(self, "No Frequency").get_text( ) == "No Frequency": # 如果界面有No Frequency显示,说明没有搜到电台 print("No Frequency") return False else: print("Success to Serach") return True
def clickEV_BATTERY(self): ''' click homePage Weather button :return: ''' element = pm._find_element_by_text(self, text="EV BATTERY") print("Click EV BATTERY") return pm.click_by_element(self, element=element)
def clickMG(self): print('start find ' + time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) element = pm._find_element_by_text(self, "MG iSMART") print("Click MG iSMART") print('end find ' + time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) return pm.click_by_element(self, element=element)
def checkIndiaCityName(self): Mumbai = pm._find_element_by_text(self, text='Mumbai').exists() Bengaluru = pm._find_element_by_text(self, text='Bengaluru').exists() NewDelhi = pm._find_element_by_text(self, text='New Delhi').exists() Chennai = pm._find_element_by_text(self, text='Chennai').exists() Hyderabad = pm._find_element_by_text(self, text='Hyderabad').exists() cityName = [Mumbai, Bengaluru, NewDelhi, Chennai, Hyderabad] if False in cityName: print('find False') print('Mumbai: ' + str(Mumbai)) print('Bengaluru: ' + str(Bengaluru)) print('NewDelhi: ' + str(NewDelhi)) print('Chennai: ' + str(Chennai)) print('Hyderabad: ' + str(Hyderabad)) return False else: print('city Name correct') return True
def clickInbox(self): # 获取主页右侧RecyclerView并上拉 BasePage._find_element_by_ClassName( self, className="android.support.v7.widget.RecyclerView").swipe('up', steps=1) print("swipe test") element = pm._find_element_by_text(self, text="Inbox") print("swipe Inbox") return pm.click_by_element(self, element=element)
def checkDefaultCityWeather(self, cityName): defaultCityName = pm._find_element_by_text(self, text=cityName) if defaultCityName.exists(): print('cityName is exist!') pm.click_by_element(self, element=defaultCityName) locationCityName = pm.find_element_by_id( self, id=india_D90_propertiseConfig.weatherPageConfig.get( 'LocationCityName')).get_text() # 获取城市名称优先比较 print('cityName: ' + cityName) print('LocationCityName: ' + locationCityName) if cityName == locationCityName: # 获取城市名称优先比较,若城市名称错误,无需进行详细信息比较 print('CityName is correct!') return self.compareWeather() else: print('CityName is not correct!') return False else: print('cityName is not exist!') return False
def searchCityByCityName(self, cityName): element = pm.find_element_by_id( self, id=india_D90_propertiseConfig.weatherPageConfig.get( 'inputCityName')) # 选择输入框 pm.inputText(self, element, cityName) # 输入框中传入地点名称 positionSearch = pm.find_element_by_id( self, id=india_D90_propertiseConfig.weatherPageConfig.get( 'PositionSearch')) # 搜索按钮 pm.click_by_element(self, positionSearch) # 点击搜索该地区 firstAddress = pm.find_element_by_id( self, id=india_D90_propertiseConfig.weatherPageConfig.get( 'ChooseFirstPosition')) addressName = firstAddress.get_text() print('addressName: ' + addressName) pm.click_by_element(self, firstAddress) self.clickSearch() # 回到搜索区域天气页面 print('click Search') element = pm._find_element_by_text(self, text=addressName) print('element Name: ' + element.get_text()) return element.exists()
def clickMG(self): element = pm._find_element_by_text(self, "MG iSMART") print("Click MG iSMART") return pm.click_by_element(self, element=element)
def clickFolder(self): element = pm._find_element_by_text(self, text="Folder") print("Click Folder") return pm.click_by_element(self, element=element)
def clickVehicle(self): element = pm._find_element_by_text(self, text="Vehicle Setting") print("Click Vehicle_setting") return pm.click_by_element(self, element=element)
def clickICall(self): element = pm._find_element_by_text(self, text="I-Call") print("Click I-Call") return pm.click_by_element(self, element=element)
def clickRadio(self): print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) element = pm._find_element_by_text(self, "Radio") print("Click Radio") print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) return pm.click_by_element(self, element=element)
def clickSetting(self): element = pm._find_element_by_text(self, "Setting") print("Click Setting") return pm.click_by_element(self, element=element)
def clickBT_Phone(self): element = pm._find_element_by_text(self, "BT Phone") print("Click BT Phone") return pm.click_by_element(self, element=element)
def clickRadio(self): element = pm._find_element_by_text(self, "Radio") print("Click Radio") return pm.click_by_element(self, element=element)
def clickVehicle(self): print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) element = pm._find_element_by_text(self, text="Vehicle Setting") print("Click Vehicle_setting") print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) return pm.click_by_element(self, element=element)
def clickVehicle(self): element = pm._find_element_by_text(self, text="MUSIC") print("Click MUSIC") return pm.click_by_element(self, element=element)
def cancelScan(self): element = pm._find_element_by_text(self, text="Cancel") # status = element.info['focusable'] print("Click cancelScan") return pm.click_by_element(self, element=element)