# 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 TestBioDrSerletti():
  def setup_method(self, method):
    self.driver = webdriver.Chrome(executable_path="C:\\Users\\malin.nemergut\\PycharmProjects\\drivers\\chromedriver.exe")
    self.vars = {}
  
  def teardown_method(self, method):
    self.driver.quit()
  
  def test_bioDrSerletti(self):
    self.driver.get("https://www.pennmedicine.org/cosmetic-services")
    self.driver.set_window_size(1342, 728)
    element = self.driver.find_element(By.CSS_SELECTOR, "#ctl05_lnkHome > .nav__level1-toggle-text")
    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.ID, "ctl05_rptPrimaryNav_spNavItemTitle_2").click()
    self.driver.find_element(By.ID, "pcmaincontent_0_rptTextHeadingsGroups_rptBio_0_personsListBioItem_0_hypViewFullProfile_0").click()
    assert self.driver.find_element(By.CSS_SELECTOR, ".h1-main__title").text == "Joseph M. Serletti, MD, FACS"
    elements = self.driver.find_elements(By.ID, "pcmaincontent_0_imgHeadshot")
    assert len(elements) > 0
    elements = self.driver.find_elements(By.CSS_SELECTOR, ".bio__body > p:nth-child(1)")
    assert len(elements) > 0
    assert self.driver.find_element(By.CSS_SELECTOR, "h2:nth-child(6)").text == "Bringing creativity and collaboration to Penn Medicine"
    elements = self.driver.find_elements(By.CSS_SELECTOR, ".photo-right")
    assert len(elements) > 0
    elements = self.driver.find_elements(By.CSS_SELECTOR, "a > strong")
    assert len(elements) > 0
    elements = self.driver.find_elements(By.LINK_TEXT, "Fill out our contact form")
    assert len(elements) > 0
    assert self.driver.find_element(By.CSS_SELECTOR, "h3").text == "Contact Us"
    self.driver.find_element(By.CSS_SELECTOR, "a > strong").click()
    assert self.driver.find_element(By.CSS_SELECTOR, ".fad-h1").text == "Joseph M. Serletti, MD, FACS"
    elements = self.driver.find_elements(By.ID, "maincontent_0_imgProviderProfile")
    assert len(elements) > 0
    self.driver.close()
  
