koushick
koushick

Reputation: 497

Mouseover move_to_element cannot be find in python

Their are Lot of Questions For Move_to_element is not working i tried everything but not working.

Am not Getting any error also. Please help me to Figure me this out

HTML Code :

<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" id="second_dropdown" css="1" style="">Our Locations
    <span class="caret"></span>
</a>

Locations.py:

import  time
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

class Locationspage():

    def __init__(self,driver):
        self.driver = driver

    def All_Locations(self):
        self.Move_to_Loc(self.driver)

    def Move_to_Loc(self,driver):
        men_menu = WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.CSS_SELECTOR,"#second_dropdown")))
        time.sleep(5)
        ActionChains(driver).move_to_element(men_menu).click(men_menu)

Am using pageobject model concept this file will be called in a seperate python file.

Finaltest.py

import unittest
from selenium import webdriver
from TestMethods.index import Wepaythemaxindex
from TestMethods.Locations import Locationspage
import time

class Wepaythemax(unittest.TestCase):
    def setUp(self):
        self.driverchrome = webdriver.Chrome("F:\\New folder\\chromedriver.exe")


    def test_Pages(self):
        driver = self.driverchrome
        driver.maximize_window()
        driver.get("http://xxx.xxx.x.xxx:xxxx/")
        driver.implicitly_wait(10)
        for text_node in driver.find_elements_by_css_selector('.cd-words-wrapper > b'):
            print(text_node.get_attribute('textContent'))

        #index Page ----
        #index = Wepaythemaxindex(driver)
        #index.checkchromedriver()

        #Locations_Page
        Location = Locationspage(driver)
        Location.All_Locations()





    def tearDown(self):
        self.driverchrome.quit()

if __name__ == '__main__':
    unittest.main()

Help me to figure this out

Upvotes: 1

Views: 61

Answers (1)

alecxe
alecxe

Reputation: 474201

The most important thing, you are not performing the action chain:

ActionChains(driver).move_to_element(men_menu).click(men_menu).perform()
#                                                              ^^^^^^^^^

Upvotes: 4

Related Questions