コード例 #1
0
    def test_Piotrklient(self):
        www="https://www.kurnik.pl/warcaby/"
# Using the driver instances created in EnvironmentSetup 
        driver = self.driver
        self.driver.get(www)
        self.driver.set_page_load_timeout(20)
        
    
        welcome=Welcome(driver)
        window_before = driver.window_handles[0]
        welcome.click_ZalogujButton()
# LOG IN
        login=Login(driver)
        login.setLogin("piotrklient")
        login.setPassword("Politechnika")
        login.click_EnterButton()

        start=Start(driver)
        start.click_StartButton()
        window_after = driver.window_handles[1]
        driver.switch_to_window(window_after)

        #print("czeeekanie na choose900")

        choose900=Choose900(driver)
        choose900.click_ChoosekindofRoom()
        #tutaj wait czeka na  zaproszenie

        #tutaj byl el=
        WebDriverWait(driver, 30).until(
        EC.visibility_of_element_located((By.XPATH, Locator.Condition)))

        AorDInvite=AcceptorDeclineInvite(driver)
        if(AorDInvite.check_Condition()==True):
            AorDInvite.click_AcceptInvite(driver)

            
        players=Players(driver)
        players.click_TakeSide2(driver) 
        #tutaj wait czeka na  accepttgame
  
        acceptgame=AcceptGame(driver)
        acceptgame.click_AcceptGame(driver)
       
        

        Coordinates=driver.find_element_by_xpath("//*[contains(@style,'top: 504') and contains(@style,'left: 84')]")
        while(True):
            print("Before click")              
            #pierwsza dodatnia to w prawo, druga ujemna to w gore
            a1,a2=Movement.Get_and_Convert()
            action = webdriver.common.action_chains.ActionChains(driver)
            action.move_to_element_with_offset(Coordinates,a1, a2)
            action.click()
            action.perform()
            print("After click")
コード例 #2
0
    def test_FirstPlayer(self):
        www="https://www.kurnik.pl/warcaby/"
# Using the driver instances created in EnvironmentSetup 
        driver = self.driver
        self.driver.get(www)
        self.driver.set_page_load_timeout(20)
        #self.driver.implicitly_wait(10)


# Creating object class Main

        print("1")
        welcome=Welcome(driver)
        window_before = driver.window_handles[0]
        welcome.click_ZalogujButton()
       
        print("2")
        login=Login(driver)
        login.setLogin("piotr1500")
        login.setPassword("Politechnika")
        login.click_EnterButton()


        print("3")
        start=Start(driver)
        start.click_StartButton()
        window_after = driver.window_handles[1]
        driver.switch_to_window(window_after)
        print("4")

        #print("Waiting  choose900")


        choose900=Choose900(driver)
        choose900.click_ChoosekindofRoom()


        newgame=NewGameTable(driver)
        newgame.click_NewGame(driver)  
        #tutaj wait

      
        players=Players(driver)
        players.click_TakeSide1()
        players.click_Players()
        
      
        #Just for show the list who want  invite
        invite=Invite(driver)
        invite.click_Invite()

        
        #Invite Client (piotrklient)
        invitesecondplayer=InviteSecondPlayer(driver)
        invitesecondplayer.click_InviteSecondPlayer(driver)
        #tutaj wait

        #need to refactor
        time.sleep(2)
        p=Players(driver)
        '''
        if p.NickPlayer.get_attribute("textContent") != "piotrklient":
            print("checking player")
            kickoff=KickOff(driver)
            kickoff.click_Kickoff()
        

        if p.NickPlayer.get_attribute("textContent") == "piotrklient":
            print("gogo")
        '''
        WebDriverWait(driver, 20).until(
        EC.visibility_of_element_located((By.XPATH, "(//*[@class='butwb'])[2]")))
        #need to refactor
        
        acceptgame=AcceptGame(driver)
        WebDriverWait(driver, 20).until(
        EC.element_to_be_clickable((By.XPATH, Locator.AcceptGame)))
        acceptgame.click_AcceptGame(driver)

        #print("1")
        #driver.execute_script("document.body.style_zoom='130%'")
        #driver.execute_script("document.body.style.zoom='90%'")
        #time.sleep(1)
        #driver.execute_script("document.body.style.zoom='100%'")
        #print("2")
        Coordinates=driver.find_element_by_xpath("//*[contains(@style,'top: 504') and contains(@style,'left: 84')]")
        while(True):
            print("Before click")              
            #pierwsza dodatnia to w prawo, druga ujemna to w gore
            a1,a2=Movement.Get_and_Convert()
            action = webdriver.common.action_chains.ActionChains(driver)
            action.move_to_element_with_offset(Coordinates,a1, a2)
            action.click()
            action.perform()
            print("After click")