def chooseTemperatureF(self):
     element = pm.find_element_by_id(
         self,
         id=india_D90_propertiseConfig.weatherPageConfig.get(
             'TemperatureF'))
     print("TemperatureF")
     return pm.click_by_element(self, element=element)
 def clickSearchSearch(self):
     element = pm.find_element_by_id(
         self,
         id=india_D90_propertiseConfig.weatherPageConfig.get(
             'PositionSearch'))
     print("Refresh Weather")
     return pm.click_by_element(self, element=element)
 def GotoWeatherPage(self):
     if pm.Home(self):
         weather = pm.find_element_by_id(
             self,
             id=india_D90_propertiseConfig.homePageConfig.get('Weather'))
         return pm.click_by_element(self, weather)
     return False
 def clickScreenHomeKey(self):
     pm.pressButtenByKeyevent(self, 'ScreenHomeKey')  # 使用屏幕Home键返回首页
     element = pm.find_element_by_id(
         self,
         id=india_D90_hardKeyPropertiseConfig.homePageConfig.get(
             'Navigation'))
     return pm.click_by_element(self, element=element)  # 检测到地图模块控件说明已返回首页
 def clickDockBarVehicleSetting(self):
     element = pm.find_element_by_id(
         self,
         id=india_D90_propertiseConfig.homePageConfig.get(
             'DockBarVehicleSetting'))
     print("Click Dock Bar VehicleSetting")
     return pm.click_by_element(self, element=element)
 def clickDockBarLockScreen(self):
     element = pm.find_element_by_id(
         self,
         id=india_D90_propertiseConfig.homePageConfig.get(
             'DockBarLockScreen'))
     print("Click Dock Bar Lock Screen")
     return pm.click_by_element(self, element=element)
Example #7
0
 def clickItem(self, text):
     elist = pm.find_element_by_id(self, id=conf.userManualPage.get('menuContentList'))
     if elist:
         pm.swipe_forwardto_description(self, text)
     element = pm.find_element_by_text(self, text=text)
     if element:
         return pm.click_by_element(self, element)
     return False
 def changeToAM(self):
     self.changeRadio()
     element = pm.find_element_by_id(
         self, id="com.archermind.saic.radio:id/btn_am")
     print("Click changeToAM")
     pm.click_by_element(self, element=element)
     time.sleep(0.5)
     if pm.find_element_by_id(
             self, id="com.archermind.saic.radio:id/tx_radio_amfm_hz_type"
     ).get_text() == 'KHz':
         print('change status to AM success')
         return True
     else:
         pm.find_element_by_id(
             self, id="com.archermind.saic.radio:id/tx_radio_amfm_hz_type"
         ).get_text()
         return False
 def clickUserIcon(self):
     '''
     click homePage UserIcon
     :return:
     '''
     element = pm.find_element_by_id(
         self, id="launcher.n4.launcher82:id/cv_image")
     return pm.click_by_element(self, element=element)
Example #10
0
 def clickMusicpreviousSong(self):
     '''
     click homePage previous song button
     :return:
     '''
     element = pm.find_element_by_id(
         self, id="launcher.n4.launcher82:id/btn_music_previous")
     return pm.click_by_element(self, element=element)
Example #11
0
 def clickMusicNextSong(self):
     '''
     click homePage next song button
     :return:
     '''
     element = pm.find_element_by_id(
         self, id="launcher.n4.launcher82:id/btn_music_next")
     return pm.click_by_element(self, element=element)
Example #12
0
 def clickMusicPause(self):
     '''
     click homePage music pause Button
     :return:
     '''
     element = pm.find_element_by_id(
         self, id="launcher.n4.launcher82:id/ll_music_control_bg")
     return pm.click_by_element(self, element=element)
Example #13
0
 def clickMusicIcon(self):
     '''
     click homePage music Icon
     :return:
     '''
     element = pm.find_element_by_id(
         self, id="launcher.n4.launcher82:id/img_music_default")
     return pm.click_by_element(self, element=element)
Example #14
0
 def clickUserCard(self):
     '''
     click homePage UserCard
     :return:
     '''
     element = pm.find_element_by_id(
         self, id="launcher.n4.launcher82:id/rl_user_card")
     return pm.click_by_element(self, element=element)
 def clickSteeringWheelVolumeUp(self):
     pm.pressButtenByKeyevent(self,
                              'clickSteeringWheelVolumeUp')  # 使用屏幕Home键返回首页
     element = pm.find_element_by_id(
         self,
         id=india_D90_hardKeyPropertiseConfig.homePageConfig.get(
             'VolumnBar'))
     return pm.click_by_element(self, element=element)  # 检测到地图模块控件说明已返回首页
 def checkRefreshTime(self):
     element = pm.find_element_by_id(
         self,
         id=india_D90_propertiseConfig.weatherPageConfig.get('refreshTime'))
     time = element.get_text()
     # time = '17:20:08 22/03/2020'
     print(time)
     print(datetime.datetime.strptime(time, '%d/%m/%Y %H:%M:%S'))
 def clickCollectAMFMHeartIcon(self):
     element = pm.find_element_by_id(
         self, id="com.archermind.saic.radio:id/btn_radio_amfm_non_heart"
     )  # 获取未收藏图标进行判断当前是否需要收藏
     if element.exists():
         print("Click Collect")
         pm.click_by_element(self, element=element)
         elementAfterClick = pm.find_element_by_id(
             self, id="com.archermind.saic.radio:id/btn_radio_amfm_heart"
         )  # 获取已收藏图标进行判断是否已被收藏
         if elementAfterClick.exists():
             print("Collected Success")
             return True
         else:
             return False
     else:
         print("Already Collected")
         return True
Example #18
0
 def clickWeather(self):
     '''
     click homePage Weather button
     :return:
     '''
     element = pm.find_element_by_id(
         self, id="com.archermind.saic.launcher:id/iv_weather_big")
     print("Click Weather")
     return pm.click_by_element(self, element=element)
Example #19
0
 def clickNav(self):
     '''
     click home page Navi button
     :return:
     '''
     element = pm.find_element_by_id(
         self, id="com.archermind.saic.launcher:id/iv_navi_image")
     print("Click Nav")
     return pm.click_by_element(self, element=element)
 def clickEnterAllPage(self):
     if pm.find_element_by_id(
             self,
             id="com.archermind.saic.radio:id/img_radio_amfm_all_selector"
     ).exists():
         print("Already in AllPage")
         return True
     else:
         element = pm.find_element_by_id(
             self, id="com.archermind.saic.radio:id/tx_radio_amfm_all")
         print("Click EnterAllPage")
         pm.click_by_element(self, element=element)
         if pm.find_element_by_id(
                 self,
                 id="com.archermind.saic.radio:id/img_radio_amfm_all_selector"
         ).exists():
             print("Enter AllPage")
             return True
         else:
             print("Fail to Enter AllPage")
             return False
Example #21
0
 def clickUserManual(self):
     pm.stopApp(conf.userManualPage.get('packageName'))
     pm.openApp(conf.userManualPage.get('packageName'))
     time.sleep(2)
     for i in range(5):
         elist = pm.find_element_by_id(self, id=conf.userManualPage.get('menuList'))
         Manual = pm.find_element_by_text(self, text=conf.userManualPage.get('titleText'))
         if Manual:
             return pm.click_by_element(self, Manual)
         time.sleep(1)
         pm.swipe_up_by_element(self, elist)
     return False
 def compareWeather(self):
     locationName = pm.find_element_by_id(
         self,
         id=india_D90_propertiseConfig.weatherPageConfig.get(
             'LocationCityName')).get_text()
     locationTemperature = pm.find_element_by_id(
         self,
         id=india_D90_propertiseConfig.weatherPageConfig.get(
             'LocationTemperature')).get_text()
     LocationTemperatureUnit = pm.find_element_by_id(
         self,
         id=india_D90_propertiseConfig.weatherPageConfig.get(
             'LocationTemperatureUnit')).get_text()
     locationMainTemperatureTypes = pm.find_element_by_id(
         self,
         id=india_D90_propertiseConfig.weatherPageConfig.get(
             'LocationMainTemperatureTypes')).get_text()
     print('-Location-' + locationName)
     print('-Location-' + locationTemperature)
     print('-Location-' + LocationTemperatureUnit)
     print('-Location-' + locationMainTemperatureTypes)
     pm.Home(self)
     time.sleep(1)
     HomePageCityName = pm.find_element_by_id(
         self,
         id=india_D90_propertiseConfig.homePageConfig.get(
             'HomePageCityName')).get_text()
     HomePageTemperature = pm.find_element_by_id(
         self,
         id=india_D90_propertiseConfig.homePageConfig.get(
             'HomePageTemperature')).get_text()
     HomePageTemperatureUnit = pm.find_element_by_id(
         self,
         id=india_D90_propertiseConfig.homePageConfig.get(
             'HomePageTemperatureUnit')).get_text()
     HomePageMainTemperatureTypes = pm.find_element_by_id(
         self,
         id=india_D90_propertiseConfig.homePageConfig.get(
             'HomePageMainTemperatureTypes')).get_text()
     print('=HomePage=' + HomePageCityName)
     print('=HomePage=' + HomePageTemperature)
     print('=HomePage=' + HomePageTemperatureUnit)
     print('=HomePage=' + HomePageMainTemperatureTypes)
     if locationName == HomePageCityName and locationTemperature == HomePageTemperature and LocationTemperatureUnit == HomePageTemperatureUnit and locationMainTemperatureTypes == HomePageMainTemperatureTypes:
         print('True')
         return True
     else:
         print('False')
         return False
 def checkWeather5Day(self):
     # 天气日期模版
     days = {
         'MON': ['MON', 'TUE', 'WED', 'THU', 'FRI'],
         'TUE': ['TUE', 'WED', 'THU', 'FRI', 'SAT'],
         'WED': ['WED', 'THU', 'FRI', 'SAT', 'SUN'],
         'THU': ['THU', 'FRI', 'SAT', 'SUN', 'MON'],
         'FRI': ['FRI', 'SAT', 'SUN', 'MON', 'TUE'],
         'SAT': ['SAT', 'SUN', 'MON', 'WED', 'WED'],
         'SUN': ['SUN', 'MON', 'TUE', 'WED', 'THU']
     }
     # 获取页面天气日期排序
     day2 = pm.find_element_by_id(
         self, id=india_D90_propertiseConfig.weatherPageConfig.get(
             'Day2')).get_text()
     day3 = pm.find_element_by_id(
         self, id=india_D90_propertiseConfig.weatherPageConfig.get(
             'Day3')).get_text()
     day4 = pm.find_element_by_id(
         self, id=india_D90_propertiseConfig.weatherPageConfig.get(
             'Day4')).get_text()
     day5 = pm.find_element_by_id(
         self, id=india_D90_propertiseConfig.weatherPageConfig.get(
             'Day5')).get_text()
     day6 = pm.find_element_by_id(
         self, id=india_D90_propertiseConfig.weatherPageConfig.get(
             'Day6')).get_text()
     dayList = [day2, day3, day4, day5, day6]
     if days[day2] == dayList:
         print('True')
         print(dayList)
         print(days[day2])
         return True
     else:
         print('False')
         print(dayList)
         print(days[day2])
         return False
 def clickLastStation(self):
     element = pm.find_element_by_id(
         self, id="com.archermind.saic.radio:id/btn_radio_amfm_last")
     print("Click LastStation")
     currentChannel = self.getCurrentChannle()  # 获取当前电台调频
     print("currentChannel " + currentChannel)
     pm.click_by_element(self, element=element)
     while True:
         if pm.find_element_by_id(
                 self,
                 id=
                 "com.archermind.saic.radio:id/btn_radio_search_dialog_cancel"
         ).exists():
             time.sleep(3)  # 等待搜台
             print("sleep 3s")
         else:
             channelAfterStep = self.getCurrentChannle()  # 点击事件后的电台调频
             print("channelAfterStep " + channelAfterStep)
             break
     if currentChannel == channelAfterStep:  # 电台没有变化
         return False
     else:
         return True
 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 closeWeatherWarning(self):
     if self.checkCloseWeatherWarning() == True:  # 天气预警已经打开直接返回True
         print('already close')
         return True
     else:
         element = pm.find_element_by_id(
             self,
             id=india_D90_propertiseConfig.weatherPageConfig.get(
                 'WeatherAlarm'))
         print("Close Weather Warning")
         pm.click_by_element(self, element=element)
         if self.checkCloseWeatherWarning() == True:
             print("Close Weather Warning Success")
             return True
         else:
             print("Close Weather Warning Fail")
             return False
 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
Example #28
0
 def swipPdf(self, up, times):
     times = int(times)
     pdfView = pm.find_element_by_id(self, id=conf.userManualPage.get('pdfView'))
     if pdfView.exists():
         if str.lower(up) == 'up':
             for i in range(0, times):
                 if pm.swipe_up_by_element(self, pdfView):
                     continue
                 else:
                     return False
             return True
         elif str.lower(up) == 'down':
             for i in range(0, times):
                 if pm.swipe_down_by_element(self, pdfView):
                     continue
                 else:
                     return False
             return True
         else:
             return False
     return False
Example #29
0
 def clickDialogCancel(self):
     Cancel = pm.find_element_by_id(
         self, id='com.saicmotor.settings:id/dialog_btn_cancel')
     return pm.click_by_element(self, Cancel)
Example #30
0
 def clickDialogOK(self):
     Ok = pm.find_element_by_id(
         self, id='com.saicmotor.settings:id/dialog_btn_ok')
     return pm.click_by_element(self, Ok)