当前位置: 首页>>代码示例>>Python>>正文


Python ActionChains.context_click方法代码示例

本文整理汇总了Python中selenium.webdriver.ActionChains.context_click方法的典型用法代码示例。如果您正苦于以下问题:Python ActionChains.context_click方法的具体用法?Python ActionChains.context_click怎么用?Python ActionChains.context_click使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在selenium.webdriver.ActionChains的用法示例。


在下文中一共展示了ActionChains.context_click方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_basic_functionality

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import context_click [as 别名]
def test_basic_functionality(driver, test_file):
	try:
		#Test page response by clicking the reset button and applying new code to ace-editor

		tt.reset_page(driver)
		tt.update_editor(driver, test_file)
		ens_elements = driver.find_elements_by_xpath('//*[@class="ens"]')
		assert (len(ens_elements) > 0)
		side_script = '''var right = document.getElementById("rightpane"); \
		right.style.width = "200px"
		'''
		driver.execute_script(side_script)

		#Creates graph objects by right clicking on nodes and selecting from menu
		actions = ActionChains(driver)
		elements = ['node', 'ens']
		for elem in elements:
			node = driver.find_element_by_xpath('//*[@class="'+elem+'"]')
			actions = ActionChains(driver)
			actions.move_to_element(node)
			actions.context_click()
			actions.perform()
			time.sleep(1)
			actions = ActionChains(driver)

			menu = driver.find_element_by_xpath('//*[@class="dropdown-menu"]/li[1]')
			actions.move_to_element(menu)
			actions.click()
			actions.perform()
			time.sleep(0.5)

		graph_elements = driver.find_elements_by_xpath('//*[@class="graph"]')

		assert len(graph_elements) > 0
		tt.start_stop_sim(driver)
		time.sleep(1.5)
		tt.start_stop_sim(driver)
		time.sleep(0.5)

		ticker = driver.find_element_by_xpath('//*[@id="ticks_tr"]/td')
		sim_time = ticker.get_attribute('textContent')

		assert (float(sim_time) > 0)

	except Exception as e:
		#Travis Only: On fail takes screenshot and uploads it to imgur


		if('TRAVIS' in os.environ):
			tt.imgur_screenshot(driver)

		_, _, tb = sys.exc_info()
		traceback.print_tb(tb) # Fixed format
		tb_info = traceback.extract_tb(tb)
		filename, line, func, text = tb_info[-1]

		print('An error occurred on line {} in statement {}'.format(line, text))
		print(str(e))
		exit(1)
开发者ID:amshenoy,项目名称:nengo_gui,代码行数:61,代码来源:test_basic_functionality.py

示例2: show_connected_variables

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import context_click [as 别名]
 def show_connected_variables(self):
     """ Show only the connected variables. """
     chain = ActionChains(self.browser)
     chain.move_to_element_with_offset(self.connections_pane, 5, 5)
     chain.context_click(None)
     chain.perform()
     time.sleep(0.5)
     self('show_connected_button').click()
开发者ID:FashtimeDotCom,项目名称:OpenMDAO-Framework,代码行数:10,代码来源:connections.py

示例3: clear

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import context_click [as 别名]
 def clear(self):
     """ Clear the workflow. """
     chain = ActionChains(self.browser)
     chain.move_to_element_with_offset(self.flow, 5, 5)
     chain.context_click(None)
     chain.perform()
     time.sleep(0.5)
     self('clear_button').click()
开发者ID:akhi28,项目名称:OpenMDAO-Framework,代码行数:10,代码来源:workflow.py

示例4: input_edit_driver

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import context_click [as 别名]
 def input_edit_driver(self, driver_pathname):
     """ Return :class:`DriverPage` associated with the input port. """
     chain = ActionChains(self.browser)
     chain.context_click(self.input_port).perform()
     time.sleep(0.5)
     self('edit_driver').click()
     editor_id = 'CE-%s' % driver_pathname.replace('.', '-')
     return DriverPage(self.browser, self.port, (By.ID, editor_id))
开发者ID:Kenneth-T-Moore,项目名称:OpenMDAO-Framework,代码行数:10,代码来源:dataflow.py

示例5: flip

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import context_click [as 别名]
 def flip(self):
     """ Flip the workflow from horizontal to vertical or vice versa. """
     chain = ActionChains(self.browser)
     chain.move_to_element_with_offset(self.flow, 5, 5)
     chain.context_click(None)
     chain.perform()
     time.sleep(0.5)
     self('flip_button').click()
开发者ID:akhi28,项目名称:OpenMDAO-Framework,代码行数:10,代码来源:workflow.py

示例6: rename_file

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import context_click [as 别名]
 def rename_file(self, old, new):
     """ Rename `old` to `new`. """
     self('files_tab').click()
     element = self.find_file(old)
     chain = ActionChains(self.browser)
     chain.context_click(element).perform()
     self('file_rename').click()
     prompt = ValuePrompt(self.browser, self.port)
     prompt.set_value(new)
开发者ID:Daiyu506,项目名称:OpenMDAO-Framework,代码行数:11,代码来源:workspace.py

示例7: view_file

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import context_click [as 别名]
 def view_file(self, filename):
     """ View image `filename` in another window via context menu. """
     self('files_tab').click()
     element = self.find_file(filename)
     chain = ActionChains(self.browser)
     chain.context_click(element).perform()
     self('file_view').click()
     self.browser.switch_to_window(self.browser.window_handles[-1])
     return BasePageObject.verify(self.browser, self.port)
开发者ID:Daiyu506,项目名称:OpenMDAO-Framework,代码行数:11,代码来源:workspace.py

示例8: delete_file

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import context_click [as 别名]
 def delete_file(self, filename):
     """ Delete `filename`. """
     self('files_tab').click()
     element = self.find_file(filename)
     chain = ActionChains(self.browser)
     chain.context_click(element).perform()
     time.sleep(0.5)
     self('file_delete').click()
     time.sleep(0.5)
开发者ID:hitej,项目名称:meta-core,代码行数:11,代码来源:workspace.py

示例9: run

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import context_click [as 别名]
 def run(self):
     """ Run this component. """
     rect = self.root.find_element_by_css_selector('rect')
     chain = ActionChains(self.browser)
     chain.move_to_element_with_offset(rect, 15, 15)
     chain.context_click(None)
     chain.perform()
     time.sleep(0.5)
     self('run_button').click()
开发者ID:akhi28,项目名称:OpenMDAO-Framework,代码行数:11,代码来源:workflow.py

示例10: evaluate

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import context_click [as 别名]
 def evaluate(self):
     """ Evaluate this component. (only available for ImplicitComponent) """
     rect = self.root.find_element_by_css_selector('rect')
     chain = ActionChains(self.browser)
     chain.move_to_element_with_offset(rect, 15, 15)
     chain.context_click(None)
     chain.perform()
     time.sleep(0.5)
     self('evaluate_button').click()
开发者ID:Daiyu506,项目名称:OpenMDAO-Framework,代码行数:11,代码来源:workflow.py

示例11: output_edit_driver

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import context_click [as 别名]
 def output_edit_driver(self, driver_pathname):
     """ Return :class:`DriverPage` associated with the output port. """
     # FIXME: can't get response from context click.
     chain = ActionChains(self.browser)
     chain.context_click(self.output_port).perform()
     time.sleep(0.5)
     self('edit_driver').click()
     editor_id = 'ObjectFrame_%s' % driver_pathname.replace('.', '-')
     return DriverPage(self.browser, self.port, (By.ID, editor_id))
开发者ID:Daiyu506,项目名称:OpenMDAO-Framework,代码行数:11,代码来源:dataflow.py

示例12: toggle_files

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import context_click [as 别名]
 def toggle_files(self, filename):
     """ Toggle files display, using context menu of `filename`. """
     self("files_tab").click()
     time.sleep(0.5)
     element = self.find_file(filename)
     chain = ActionChains(self.browser)
     chain.context_click(element).perform()
     time.sleep(0.5)
     self("file_toggle").click()
     time.sleep(0.5)
开发者ID:RacerXFD,项目名称:OpenMDAO-Framework,代码行数:12,代码来源:workspace.py

示例13: _context_click

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import context_click [as 别名]
 def _context_click(self, name):
     """ Display context menu. """
     chain = ActionChains(self.browser)
     # Default is centered which causes problems in some contexts.
     # Offset is apparently limited, (20, 20) had problems.
     chain.move_to_element_with_offset(self.root, 15, 15)
     chain.context_click(None)
     chain.perform()
     time.sleep(0.5)
     self(name).click()
开发者ID:Kenneth-T-Moore,项目名称:OpenMDAO-Framework,代码行数:12,代码来源:dataflow.py

示例14: test_example

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import context_click [as 别名]
def test_example(driver):
	# Always include driver as a function parameter.
	# This is the selenium webdriver that will allow
	# you to interact with the webpage.

	tt.reset_page(driver)
	# Most testing_tools functions require driver as an input.
	# Presses the reset button to start the page fresh.
	# Usually useful but not always needed.
	# More documentation on testing_tools can be found
	# in nengo_gui/testing_tools.py

	time.sleep(1)
	# Waits a small amount of time to ensure the page has
	# time to reset.

	tt.update_editor(driver,'''
import nengo

model = nengo.Network()
with model:
    stim = nengo.Node([0])
    a = nengo.Ensemble(n_neurons=50, dimensions=1)
    nengo.Connection(stim, a)
		''')
	# The page will now load this code into the code editor

	stim = driver.find_element_by_xpath('//*[@class="node"]')
	a = driver.find_element_by_xpath('//*[@class="ens"]')
	# Finds the 'stim' and 'a' nodes and saves them as a webElements.

	action = ActionChains(driver)
	# ActionChains allow you to link together multiple mouse events
	# then execute them in that order.

	action.move_to_element(stim);
	action.context_click()
	action.perform()
	time.sleep(1)
	# The stim element has now been right clicked.

	# WARNING: when using ActionChains reinitialize ActionChains
	# after every .perform() call, it is not clear why but
	# ActionChains does not seem to reset properly after this call.

	right_click_menu = driver.find_element_by_xpath('//*[@class="dropdown-menu"]')

	assert(bool(stim) and bool(a) == True)
	# Tests if both elements are present.

	assert(bool(right_click_menu) == True)
	# Tests if stim has been properly clicked

	if('TRAVIS' in os.environ): ########## TRAVIS ONLY
		tt.imgur_screenshot(driver)
开发者ID:amshenoy,项目名称:nengo_gui,代码行数:57,代码来源:test_example.py

示例15: view_library_item_docs

# 需要导入模块: from selenium.webdriver import ActionChains [as 别名]
# 或者: from selenium.webdriver.ActionChains import context_click [as 别名]
    def view_library_item_docs(self, item_name):
        chain = ActionChains(self.browser)
        current_windows = set(self.browser.window_handles)
        self.show_library()
        item = self.get_library_item(item_name)
        chain.context_click(item).perform()
        self("library_item_docs").click()
        new_windows = set(self.browser.window_handles) - current_windows
        docs_window = list(new_windows)[0]

        return docs_window
开发者ID:Daiyu506,项目名称:OpenMDAO-Framework,代码行数:13,代码来源:workspace.py


注:本文中的selenium.webdriver.ActionChains.context_click方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。