Esempio n. 1
0
    def test_firmware(self):
        self.driver.find_element_by_xpath("//*[@id='fwupdate']/a").click()
        self.driver.switch_to_frame("center")
        wait = WebDriverWait(self.driver, 10)
        wait.until(
            expected_conditions.visibility_of_element_located(
                (By.XPATH, "//*[@id='fwupdateForm']/p[2]/input")))
        self.driver.find_element_by_xpath(
            "//*[@id='fwupdateForm']/p[2]/input").click()
        sleep(1)
        robot = Robot()
        robot.add_to_clipboard("I:\Share\Umesh\Firmware\DTE\dte101_1.2.6.nxf")
        robot.paste()
        robot.press_and_release(Keys.enter)

        self.driver.find_element_by_xpath("//input[@type='submit']").click()
        wait.until(
            expected_conditions.visibility_of_element_located(
                (By.XPATH, "//*[@id='contentIframe']/p[1]/b")))
        self.assertEqual(
            self.driver.find_element_by_xpath(
                "//*[@id='contentIframe']/p[1]/b").text,
            "Firmware transfer and update succeeded!")
        sleep(1)
        self.driver.find_element_by_xpath("//input[@type='checkbox']").click()
        self.driver.find_element_by_xpath("//input[@type='submit']").click()
        wait.until(
            expected_conditions.visibility_of_element_located(
                (By.XPATH, "//*[@id='contentIframe']/p[1]")))
        self.assertEqual(
            self.driver.find_element_by_xpath(
                "//*[@id='contentIframe']/p[1]").text,
            "The device was successfully restarted.")
        self.verify_settings()
    def test_setUp(self):
        Util.init_ChromeDriver(self)
        #Util.init_IE_Driver(self)

        self.driver.maximize_window()
        self.driver.get('http://192.168.0.79')
        yield
        self.driver.switch_to_default_content()
        sleep(2)
        self.driver.find_element_by_id('system').click()
        #self.driver.find_element_by_id('system').click()
        sleep(2)
        robot = Robot()
        robot.add_to_clipboard("admin")
        robot.paste()
        sleep(1)
        robot.press_and_release(Keys.tab)
        sleep(1)
        robot.add_to_clipboard("iepl")
        robot.paste()
        sleep(1)
        robot.press_and_release(Keys.enter)
        self.driver.switch_to_frame("center")
        wait = WebDriverWait(self.driver, 10)
        wait.until(
            expected_conditions.visibility_of_element_located(
                (By.XPATH, "//*[@id='pwpForm']//input[@value='off']")))
        self.driver.find_element_by_xpath(
            "//*[@id='pwpForm']//input[@value='off']").click()
        self.setPassword("iepl", "admin")
        self.driver.quit()
Esempio n. 3
0
import os
from pyrobot import Robot

os.chdir("c:/Users/Heitor/Desktop/emacs-24.3/bin/shared/python/pontual/robo/")
robot = Robot()

robot.set_mouse_pos(40, 40)
robot.click_mouse(button="left")

robot.press_and_release("F9")
Esempio n. 4
0
def order(k, folder_name, path_upload, photo_path_final):

    #Lauching chrome in mobile version
    mobileEmulation = {'deviceName': 'Pixel 2'}
    options = webdriver.ChromeOptions()
    options.add_experimental_option('mobileEmulation', mobileEmulation)
    driver = webdriver.Chrome(executable_path='chromedriver.exe',
                              chrome_options=options)

    #setting the photo_path and the caption text
    photo_path = photo_path_final
    caption_path = path_upload + '\\' + folder_name + '\\text.txt'
    print(photo_path)
    content_array = []
    with open(caption_path) as f:
        for line in f:
            content_array.append(line)
    print(content_array)

    #going to instagram page and loging in
    driver.get(k['URL_insta'])
    time.sleep(1)
    driver.find_element_by_name('username').send_keys(k["username"])
    driver.find_element_by_name('password').send_keys(k["password"])
    driver.find_element_by_name('password').send_keys(Keys.RETURN)
    wait = ui.WebDriverWait(driver, 20)

    #dealing with the popups
    time.sleep(10)
    if driver.find_element_by_xpath(
            '/html/body/div[3]/div/div/div[3]/button[2]') != 0:
        driver.find_element_by_xpath(
            '/html/body/div[3]/div/div/div[3]/button[2]').click()

    #Photo being selected and uploaded
    time.sleep(4)
    robot = Robot()
    xerox.copy(photo_path_final)
    driver.find_element_by_xpath(
        '//*[@id="react-root"]/section/nav[2]/div/div/div[2]/div/div/div[3]'
    ).click()
    time.sleep(4)
    robot.paste()
    robot.press_and_release('enter')

    #photo being adjusted
    time.sleep(2)
    driver.find_element_by_xpath(
        '//*[@id="react-root"]/section/div[2]/div[2]/div/div/div/button[1]'
    ).click()
    driver.find_element_by_xpath(
        '//*[@id="react-root"]/section/div[1]/header/div/div[2]/button').click(
        )

    #Putting the caption and posting the image
    time.sleep(2)
    driver.find_element_by_xpath(
        '//*[@id="react-root"]/section/div[2]/section[1]/div[1]/textarea'
    ).click()
    driver.find_element_by_xpath(
        '//*[@id="react-root"]/section/div[2]/section[1]/div[1]/textarea'
    ).send_keys(content_array)
    driver.find_element_by_xpath(
        '//*[@id="react-root"]/section/div[1]/header/div/div[2]/button').click(
        )

    #Posting the image
    time.sleep(15)
    driver.quit()
    done = "Photo:" + photo_path + " Successfully uploaded"
    print(done)
    return done