1
+ from selenium import webdriver
2
+ import time
3
+ import stdiomask
4
+
5
+ # Enter your gmail credentials
6
+ username = input ("Enter your gmail user id: " )
7
+
8
+ # In this example, I am using stdiomask to hide the entry of the password entry.
9
+ # This will store it into a variable for it to be used when passing this onto
10
+ # the webdriver object.
11
+ # Note: Using stdiomask does not encrypt your password, it only masks the entry.
12
+ # Do not consider stdiomask as a completel secure transport protocol. It's only
13
+ # a masking tool.
14
+
15
+ password = stdiomask .getpass ("Enter Password: " )
16
+
17
+ # Build the webdriver object. Use it to instantiate the use of the Firefox browser.
18
+ # Note: You can utilize other browser drivers, do a search on webdriver options.
19
+
20
+ driver = webdriver .jFirefox ()
21
+ driver .get ("http://gmail.google.com" )
22
+
23
+ # Time to send the credentials over to the driver object.
24
+ driver .find_element_by_id ("identifierId" ).send_keys (username )
25
+ driver .find_element_by_id ("identifierNext" ).click ()
26
+ time .sleep (5 )
27
+
28
+ # Note: At the time of the testing of this, the password is not passing into the field.
29
+ # The userid on the other hand is passing to the user name is updating in the browser.
30
+ # I don't feel like traversing the mounds of javascript code on google website, but if anyone
31
+ # wants to, and update that script that would be nice.
32
+ # I'm just providing this as an example of selenium, and some future reference should I need to
33
+ # do this for a project someday.
34
+ driver .find_element_by_name ("input[type=password]" ).send_keys (password )
35
+ driver .find_element_by_id ("passwordNext" ).click ()
36
+ time .sleep (5 )
0 commit comments