How to insert an image using selenium in Google slides?

…衆ロ難τιáo~ 提交于 2020-06-23 14:15:09

问题


I've been trying to insert an image to a google slide but I can only the dropdown icon and not the menu items. The google slides HTML portion of the menu looks like this.

<div class="goog-menuitem apps-menuitem" role="menuitem" id="955fby:sw" style="user-select: none;"> 
    <div class="goog-menuitem-content" style="user-select: none;">
        <div class="docs-icon goog-inline-block goog-menuitem-icon" aria-hidden="true" style="user-select: none;">
            <div class="docs-icon-img-container docs-icon-img docs-icon-file-upload" style="user-select: none;"></div>
        </div>
        <span class="goog-menuitem-label" style="user-select: none;">Upload from computer</span>
    </div>
</div>

I couldn't go further on the dropdown menu. I can't click the menu items by using XPath, class name, id, CSS.

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
options = Options()
options.add_argument("start-maximized")
options.add_argument("user-data-dir=C:\\Users\\praba\\AppData\\Local\\Google\\Chrome\\User Data\\")

driver = webdriver.Chrome(executable_path=r'chromedriver',options=options)
time.sleep(5)
driver.get("https://docs.google.com/presentation/u/0/create?usp=slides_web")
time.sleep(5)
driver.find_element_by_id('insertImageMenuButton').click()

来源:https://stackoverflow.com/questions/62300818/how-to-insert-an-image-using-selenium-in-google-slides

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!