def ff_configure(): from seleniumDEMO import webdriver #import sys #reload(sys) #sys.setdefaultencoding('utf8') #ff_driver=webdriver.Firefox() profile = webdriver.FirefoxProfile( "E:\\svn\\develop\\AutoTest_Emao\\public\\ff_config") ff_driver = webdriver.Firefox(profile) return ff_driver
def setUp(self): self.driver = webdriver.Firefox()
# coding=utf-8 import sys import time from seleniumDEMO import webdriver from seleniumDEMO.webdriver.common.action_chains import ActionChains from time import ctime driver = webdriver.Firefox() driver.get("https://passport.opifices.com/?redirect=https%3A%2F%2Fopifices.com%2F%23%2F") print("设置宽高") driver.set_window_size(800, 1000) File_Path = '/Users/jichen/Desktop/AndroidTool/iOSjichen04132016142311.png' time.sleep(3) tt = driver.implicitly_wait(3) # 这个tt只是为了方便 driver.find_element_by_id('user_mobile').send_keys('18610152142') # 输入账号 driver.find_element_by_id('user_password').send_keys('123qwe') # 输入密码 driver.find_element_by_class_name('btn-fixed').click() # 点击登录 tt # 上传图片是个坑需要js调整css里的display time.sleep(3) js_idcard = '$("[name=\'upload_idcard\']").show()' driver.execute_script(js_idcard) driver.find_element_by_name('upload_idcard').send_keys(File_Path) time.sleep(3)