python 2.7 - How to insert an image into docs.google.com using Selenium? -



python 2.7 - How to insert an image into docs.google.com using Selenium? -

i strarted researching selenium want insert image docs.google.com ran script didn't click button "choose image upload".. please, help me. code below

__author__ = 'sdn' selenium import webdriver selenium.webdriver.support.ui import webdriverwait selenium.webdriver.common.keys import keys selenium.webdriver.common.action_chains import actionchains import unittest class logintest(unittest.testcase): def setup(self): self.driver = webdriver.firefox() self.driver.get("https://docs.google.com") def test_login(self): driver = self.driver email = "username" passwd = "userpassword" emailelement = driver.find_element_by_id("email") passwdelement = driver.find_element_by_id("passwd") emailelement.clear() emailelement.send_keys(email) passwdelement.clear() passwdelement.send_keys((passwd)) loginelement = driver.find_element_by_id("signin") loginelement.click() addelement = webdriverwait(driver, 20).until(lambda driver: driver.find_element_by_css_selector("#docs-homescreen-add")) addelement.click() insert = webdriverwait(driver, 20).until(lambda driver: driver.find_element_by_id("docs-insert-menu")) insert.click() actionchains(driver).send_keys(keys.arrow_down).send_keys(keys.return).perform() driver.find_element_by_class_name("a-b-c d-u d-u-f").click() actionchains(driver).send_keys("/home/sdn/downloads/image.jpg").send_keys(keys.return).perform() if __name__ == '__main__': unittest.main()

python-2.7 selenium automation

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -