# Generated by Selenium IDE
import pytest
import time
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities


class TestTestsuite2():
    def setup_method(self, method):
        self.driver = webdriver.Chrome()
        self.driver.implicitly_wait(5)
        self.vars = {}

    def teardown_method(self, method):
        self.driver.quit()

    def test_testclick(self):
        self.driver.get("https://ceshiren.com/")
        self.driver.set_window_size(1361, 694)
        self.driver.find_element(By.CSS_SELECTOR, ".sortable:nth-child(4)").click()
        self.driver.find_element(By.LINK_TEXT, "精华帖").click()
        self.driver.find_element(By.LINK_TEXT, "开源项目").click()

    def test_testclick1(self):
        self.driver.get("https://ceshiren.com/")
        self.driver.set_window_size(1361, 694)
        element = self.driver.find_element(By.CSS_SELECTOR, "li:nth-child(1) img")
        actions = ActionChains(self.driver)
        actions.move_to_element(element).perform()
        element = self.driver.find_element(By.CSS_SELECTOR, "body")
        actions = ActionChains(self.driver)
        actions.move_to_element(element, 0, 0).perform()
        self.driver.find_element(By.LINK_TEXT, "热门").click()
        self.driver.execute_script("window.scrollTo(0,0)")
        self.driver.find_element(By.LINK_TEXT, "近期（7）").click()
        self.driver.find_element(By.LINK_TEXT, "精华帖").click()
