VT2019 Selenium Demo

From air
Revision as of 15:29, 23 November 2019 by Victor.Cuau (talk | contribs) (Create page + add demo code)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Cette page héberge la démonstration en lien avec la fiche Selenium dans le cadre du cours de veille technologique 2019.

Pré-requis & Installation

Démonstration

Connexion à Facebook

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

# Credentials
user_name = "victor.cuau@hotmail.fr"
password = "VousAurezPasMonPassword"

# Launch the Chrome web browser
driver = webdriver.Chrome()
#driver.set_window_size(1400, 800)

# Load the Facebook website
driver.get("https://www.facebook.com")

# Enter the email address
element = driver.find_element_by_id("email")
element.send_keys(user_name)

# Enter the password
element = driver.find_element_by_id("pass")
element.send_keys(password)

# Press enter
element.send_keys(Keys.ENTER)

Affichage de l'emploi du temps de la filière INFO5 sur ADE

import time
from selenium import webdriver

# Launch the Chrome web browser
driver = webdriver.Chrome()
#driver.set_window_size(1400, 800)

# Load the page of the application ADE
driver.get("https://ade-sts.grenet.fr/direct/?data=1d04874d83cdeb530ab2ed27f8ac9ed37b49833cd1da9037e125b57a76b56adad09ddf0fa9386d6871978644e3168e1c010fd1cf0671c9ff9c3a152b08424f005b0f43ab5831667cc025f5e16438a90e7406158408bd7b08")
time.sleep(4)  # Wait for the graphic interface

# Open folder "Etudiant"
folder = driver.find_element_by_xpath('//*[@id="Direct Planning Tree_-1"]/div/img[2]')
folder.click()
time.sleep(2)

# Open folder "POLYTECH"
folder = driver.find_element_by_xpath('//*[@id="Direct Planning Tree_12522"]/div/img[2]')
folder.click()
time.sleep(2)

# Open folder "INFO"
folder = driver.find_element_by_xpath('//*[@id="Direct Planning Tree_11584"]/div/img[2]')
folder.click()
time.sleep(2)

# Open folder "INFO 5"
folder = driver.find_element_by_xpath('//*[@id="Direct Planning Tree_11599"]/div/img[2]')
folder.click()
time.sleep(2)

# Click on "INFO5 - Option Réseaux"
edt = driver.find_element_by_xpath('//*[@id="Direct Planning Tree_x-auto-261"]/table/tbody/tr')
edt.click()