Это много вопросов, потому что Move_to_element не работает, я попробовал все, но не работает.
Не получаю также никакой ошибки.Пожалуйста, помогите мне разобраться в этом
HTML код:
<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)
Использую концепцию модели pageobject, этот файл будет вызываться в отдельном файле python.
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()
Помогите разобраться с этим