本文整理汇总了Python中selenium.webdriver.firefox.firefox_profile.FirefoxProfile.native_events_enabled方法的典型用法代码示例。如果您正苦于以下问题:Python FirefoxProfile.native_events_enabled方法的具体用法?Python FirefoxProfile.native_events_enabled怎么用?Python FirefoxProfile.native_events_enabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类selenium.webdriver.firefox.firefox_profile.FirefoxProfile
的用法示例。
在下文中一共展示了FirefoxProfile.native_events_enabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: launch_browser
# 需要导入模块: from selenium.webdriver.firefox.firefox_profile import FirefoxProfile [as 别名]
# 或者: from selenium.webdriver.firefox.firefox_profile.FirefoxProfile import native_events_enabled [as 别名]
def launch_browser():
if env.RUNNING_BROWSER.upper() == "FIREFOX":
# the end of the browser process , the end of the browser driven process
os.popen("TASKKILL /F /IM firefoxdriver.exe")
fp = FirefoxProfile()
fp.native_events_enabled = False
binary_path = PublicImp.common.get_value_from_conf("FIREFOX_BINARY_PATH")
if binary_path == "":
env.driver = selenium.webdriver.Firefox(firefox_profile=fp)
else:
fb = FirefoxBinary(firefox_path=binary_path)
env.driver = selenium.webdriver.Firefox(firefox_profile=fp, firefox_binary=fb)
elif env.RUNNING_BROWSER.upper() == "CHROME":
os.popen("TASKKILL /F /IM chromedriver.exe")
binary_path = PublicImp.common.get_value_from_conf("CHROME_BINARY_PATH")
chromedriver = PublicImp.common.get_value_from_conf("DRIVER_CHROME")
if binary_path == "":
os.environ["webdriver.chrome.driver"] = chromedriver
env.driver = selenium.webdriver.Chrome(executable_path=chromedriver)
else:
opts = Options()
opts.binary_location = binary_path
os.environ["webdriver.chrome.driver"] = chromedriver
env.driver = selenium.webdriver.Chrome(executable_path=chromedriver, chrome_options=opts)
elif env.RUNNING_BROWSER.upper() == "IE":
os.popen("TASKKILL /F /IM IEDriverServer.exe")
dc = DesiredCapabilities.INTERNETEXPLORER.copy()
dc['acceptSslCerts'] = True
dc['nativeEvents'] = True
iedriver = PublicImp.common.get_value_from_conf("DRIVER_IE")
os.environ["webdriver.ie.driver"] = iedriver
env.driver = selenium.webdriver.Ie(executable_path=iedriver, capabilities=dc)
else:
return False
env.platformName = env.RUNNING_BROWSER
env.TEST_URL = PublicImp.common.get_value_from_conf("TESTING_URL")
env.driver.get(env.TEST_URL)
env.driver.maximize_window()
time.sleep(3)
env.driver.refresh()
# env.driver.set_window_size(480, 800)
time.sleep(3)
return True
示例2: make_driver
# 需要导入模块: from selenium.webdriver.firefox.firefox_profile import FirefoxProfile [as 别名]
# 或者: from selenium.webdriver.firefox.firefox_profile.FirefoxProfile import native_events_enabled [as 别名]
def make_driver(context):
'''
Создать объект-драйвер для взаимодействия с браузером.
Можно вызывать в before_feature, если мы хотим каждый тест проводить,
в отдельном браузере.
P.S. в таком случае, не забыть в after_feature закрывать браузер.
'''
# использовать конкретные бинарники
print ('Opening browser now!')
path_to_binary = getcwd() + '/steps/data/firefox/firefox'
binary = FirefoxBinary(path_to_binary)
profile = FirefoxProfile()
profile.native_events_enabled = False
context.list_ud = list()
# выбор профиля
if "win" in platform:
context.browser = webdriver.Firefox(firefox_profile=profile)
else:
context.browser = webdriver.Firefox(firefox_profile=profile, firefox_binary=binary)
context.browser.maximize_window()