def getLocationvalue(): location = driver.find_element_by_xpath('//*[@id="X3"]').get_attribute('value') company = driver.find_element_by_xpath('//*[@id="X23"]').get_attribute('value') country = driver.find_element_by_xpath('//*[@id="X45"]').get_attribute('value') address = driver.find_element_by_xpath('//*[@id="X21"]').get_attribute('value') comments = driver.find_element_by_xpath('//*[@id="X55"]').get_attribute('value') city = driver.find_element_by_xpath('//*[@id="X33"]').get_attribute('value') timeZone = driver.find_element_by_xpath('//*[@id="X53"]').get_attribute('value') # 打印SM200的数据 # print('SM-DATA-LIST') # print('Location: ' + location) # print('Company code: ' + company) # print('Country: ' + country.upper()) # print('--------------------------') if location == Location_tab.name() \ and company == Location_tab.company() \ and country.upper() == Location_tab.country()\ and city == Location_tab.city()\ and timeZone == Location_tab.timeZone()\ and comments == Location_tab.comments(): print('Company code: '+ company + ', Location: '+ location + ', Country: '+ country + ', City: '+ city + ', TimeZone: '+ timeZone + ' Comments: '+ comments) else: print('No Record Found')
def getLDSSlocation(): list = [Location_tab.name(), Location_tab.country(), Location_tab.city(), Location_tab.company()]
# print('Country:', list[1]) # 选取db中的Location Table def chooseLocationTable(): driver.find_element_by_xpath('//*[@id="X9"]').send_keys('location') time.sleep(3) driver.find_element_by_xpath('//*[@id="X13"]').click() time.sleep(3) driver.find_element_by_link_text('location').click() time.sleep(3) # 搜索后按Search button进入详细信息 def clickSearchButton(): driver.find_element_by_xpath('//button[@aria-label="Start this Search (Ctrl+Shift+F6)" and @type="button"]').click() time.sleep(3) driver = webdriver.Chrome() if __name__=="__main__": loginsm200() openSMdb() chooseLocationTable() driver.find_element_by_xpath('//*[@id="X17"]').send_keys(Location_tab.name()) time.sleep(3) driver.switch_to.default_content() clickSearchButton() driver.switch_to.frame('ext-gen-top372') getLocationvalue() getLDSSlocation() driver.switch_to.default_content() time.sleep(3) logoutsm200()