0

i am using selenium web driver with python.In my test case i have a menu which opens a submenu(has mouse over so i am using action_chains to click) and when click on it moves to next screen.

in that screen i need to check save, delete, reset option function.but whenever i perform click on any of those button and it also clicks on that menu and displays the drop down menu.

this screen is not frame.so i am not able to use driver.switch_to_frame(frame_id). why i am getting this and what is the solution for this problem.

This my code:(is not one i am using but this is same with my code)

This is my main tab 1 2 3 4 (consider this all menu has submenu)

whatever new screen opens all displayed below this tab.this visible for all screens i am using.

menu= menu element
submenu= sub menu element
hover = ActionChains(driver)
hover.move_to_element(menu).click()
hover.click(submenu)
hover.perform() 

Now a new screen opens which have save, reset options

now doing following:

1 st driver.find_element_by_id("field to fill").clear() driver.find_element_by_id("field to fill").send_keys(value)

2 nd driver.find_element_by_id("field to fill").clear() driver.find_element_by_id("field to fill").send_keys(value)

3rd driver.find_element_by_id("field to fill").clear() driver.find_element_by_id("field to fill").send_keys(value)

4 th driver.find_element_by_id("field to fill").clear() driver.find_element_by_id("field to fill").send_keys(value)

now i am clicking save button.

driver.find_element_by_id("save").click()

during this time creates a problem when this click occurs it is clicking the menu item again and show the drop down of menu item.

Dheepan
  • 35
  • 8

1 Answers1

0

What you are asking is how do you move the mouse (as the user would) to trigger the submenu/drop down menu. (or at least i think that's what you mean)

Start by finding the element, then use the mouse over function provided by selenium. Then move the mouse to the next element (e.g. Save, Delete, Etc)

Here is an example in java, the code will be similar. How to perform mouseover function in Selenium WebDriver using Java?

I believe Frame refers to another instance of a window, such as when a popup, or another site opens from a page anchor.

Community
  • 1
  • 1
jonh
  • 242
  • 2
  • 10
  • First point you said is absolutely correct. all the submenu items opens difference html, in that i am clicking one(this sudmenu has mouse over, so i am using Achains_chains) and shows that html screen. and if i perform click on the button(input type=reset,type=button)in that html it is again perform the click on that menu item and shows the submenu drop down again. – Dheepan Jan 09 '14 at 06:57