-
Notifications
You must be signed in to change notification settings - Fork 0
/
kiosk_with_login.py
executable file
·47 lines (36 loc) · 1.28 KB
/
kiosk_with_login.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import time
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
#caps = DesiredCapabilities.FIREFOX
#caps["marionette"] = True
#caps["binary"] = "/usr/bin/firefox"
#Open first tab
browser = webdriver.Firefox()
browser.get("https://www.reddit.com")
browser.implicitly_wait(20)
user = browser.find_element_by_name('user')
passw = browser.find_element_by_name('passwd')
form = browser.find_element(By.XPATH, '//button[text()="login"]')
user.send_keys('yourusername')
passw.send_keys('yourpassword')
form.submit()
#Open second tab
new_window = browser.find_element_by_tag_name("body").send_keys(Keys.CONTROL + "t")
browser.switch_to.window(browser.window_handles[-1])
browser.get("http://www.google.com")
#Open third tab
new_window = browser.find_element_by_tag_name("body").send_keys(Keys.CONTROL + "t")
browser.switch_to.window(browser.window_handles[-1])
browser.get("https://slashdot.org")
#browser fullscreen
new_window = browser.find_element_by_tag_name("body").send_keys(Keys.F11)
#Every 20 secs change tab
x=1
while x:
try:
new_window = browser.find_element_by_tag_name("body").send_keys(Keys.CONTROL + Keys.TAB)
time.sleep(20)
except:
break