The end goal is to send myself an email if my public ip address changes, as I don't have dynamic dns and have to manually enter the ip addresses myself for my web server. I've done all I possibly can to try and get bash utilities to do the job for me, but CenturyLink is unfortunately out to block me no matter how I configure my outbound mail.
So I've turned to graphical python/selenium web page automation, which will sign into my gmail account for me, click the 'compose' button, then enter in the To:, Subject:, and text segments and hit send. Everything is working except for one small part - the To: field. The html/css is different for this than all the others and no matter how I try to select the field using
driver.find_element_by_class_name()
or
driver.find_element_by_id()
I just can't seem to fill out the field. Bash will give me an error like
:lo cannot be reached by keyboard
or textarea#:lo.vO is not a valid selector
When I did an inspect element, the element looked like this:
<textarea rows="1" id=":lo" class="vO" name="to" spellcheck="false" autocomplete="false" autocapitalize="off" autocorrect="off" tabindex="1" dir="ltr" aria-label="To" role="combobox" aria-autocomplete="list" style="width: 462px;"></textarea>
My code so far is this: (note: which does not include getting ip info yet, just gmail login / manipulation)
from selenium import webdriver
import time
driver = webdriver.Firefox();
driver.get('https://www.gmail.com');
username = driver.find_element_by_id('identifierId');
username.send_keys("EMAIL");
driver.find_elements_by_class_name('RveJvd.snByac')[1].click();
time.sleep(2); #password not entered in username field
password = driver.find_element_by_class_name('whsOnd.zHQkBf');
password.send_keys("PASSWORD");
driver.find_elements_by_class_name('RveJvd.snByac')[0].click();
#end login, start composing
time.sleep(5); #wait for sign in
driver.find_element_by_class_name('T-I.J-J5-Ji.T-I-KE.L3').click();
to = driver.find_element_by_class_name('textarea#:lo.vO'); #incorrect
to.send_keys("EMAIL");
subject = driver.find_element_by_id(':l6');
subject.send_keys("IP Address changed");
content = driver.find_element_by_id(':m9');
content.send_keys("Test Test\n");