# Generated by Selenium IDE
#进入testerhome，访问社团，访问霍格沃兹测试学院，访问最顶部的第一个帖子
import pytest
import time
import json
from selenium import webdriver
from selenium.webdriver.common import by
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 TestDefaultSuite():
  def setup_method(self, method):
    self.driver = webdriver.Chrome()
    self.driver.get("https://testerhome.com/")
    self.driver.set_window_size(1280, 680)
    self.driver.implicitly_wait(5)
    self.wait=WebDriverWait(self.driver,10)


  def test_testzuoye(self):
    self.driver.find_element(By.LINK_TEXT, "社团").click()
    element=(By.CSS_SELECTOR, '[title="霍格沃兹测试学院(hogwarts)"]')
    self.wait.until(expected_conditions.element_to_be_clickable(element))
    self.driver.find_element(*element).click()
    # self.driver.find_element(By.CSS_SELECTOR, '[title="霍格沃兹测试学院(hogwarts)"]').click()
    self.driver.find_element(By.CSS_SELECTOR, ".topic-22195 .title > a").click()
  

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