Selenium and Chrome for QQ login and send mail action instance details

Selenium and Chrome for QQ login and send mail operation instances

QQ mailbox variety of iframes need to switch, delay is necessary, Looking for elements through various methods, QQ mail body iframe Name is changing, and there are several other methods, and finally actually used. o [0] .click (), o [0] .send_keys (“abc”), has to study research! ! !

Note: I have already logged in to the QQ client on the machine. XXXX is sending QQ number. YYYY is accepting QQ number

 from Selenium Import WebDriverImport TimeImport Sysif 1: driver = Webdriver.chrome () driver.get ('http://www.qq.com') QQ_HANDLE = driver.current_window_handle driver.find_Element_BY_XPATH ('' '// * [@ id = "LogingrayLayout"]' ' ') .click () time.sleep (1) driver.switch_to.frame (' login_frame ') driver.find_element_by_xpath (' '' // * [@ ID = "IMG_OUT_XXXXX"] ''). Click () Time. Sleep (1) driver.refresh () driver.find_element_by_xpath ('' '// * [@ id = "mailgrayiconlogin"] / a' '). click () all_handles = driver.window_handlesTime.Sleep (1) driver.switch_to.window (all_handles [1]) driver.find_elements_by_css_selector ('# composebtn') [0] .click () # Time.sleep (1) driver.switch_to.frame ('mainframe') DRIVER.FIND_ELEMENT_BY_XPATH ('' '// * [@ id = "toareAractrl"] / div [2] / infut' ''). Send_keys ("xxxxx@vip.qq.com") driver.find_element_by_xpath ('') /* [@id="subject"]''').send_keys ("test mail subject ") o = driver.find_elements_by_class_name (" QMeditorifrmediTarea ") o [0] .click () o [0] .send_keys (" Hello World! ") driver.find_element_by_xpath ('' '// * [@ id =" Toolbar "] / div / a [1]' '). Click () sys.exit (0) driver = webdriver.chrome () Driver.get ('http://mail.qq.com') driver.switch_to.frame ("login_frame") driver.find_element_by_xpath ('' '// * [@ id = "IMG_OUT_XXXXX"]' '). Click () Time.Sleep (1) driver.find_elements_by_css_selector ('# composebTN ') [0] .Click () time.sleep (1) driver.switch_to.frame (' mainframe ') Time.Sleep (1) driver.find_element_by_xpath (' '// * [@ id = "toareAractRL"] / DIV [2] / INPUT ''). Send_keys ("YYYYY @viP.qq.com") Driver.find_Element_BY_XPATH ('' '// * [@ id = "subject"]' ''). Send_keys (" Test mail subject ") o = driver.find_elements_BY_CLASS_NAME (" QMEDITORIFRMEDITAREA ") o [0] .click () #must click .... shit !!!! o [0] .send_keys (" abc ") driver.find_Element_BY_XPATH ( '' //* [@id="toolbar"]/div/a[1]'''').click() 
Thank you for reading, hope to help To everyone, thank you for your support of this site!

© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment