我使用最新的 Chrome 和 chromedriver。
我有一個包含 DOM 元素的網站,我將在輸入欄位
HTML 代碼中輸入任何文本 (抱歉截圖)

Python 代碼:
#Expand Shadow
def expand_shadow_element(element):
shadow_root = driver.execute_script('return arguments[0].shadowRoot.children', element)
return shadow_root
...
root1 = driver.find_element_by_id("UI-tf_Vorgangsname")
shadow_root1 = expand_shadow_element(root1)
root2 = shadow_root1 
uj5u.com熱心網友回復:
我有一個解決方案。
Sendkeys 不起作用,但我找到了一個混合解決方案。
我使用這個沒有 send_keys 的 Python 腳本,我使用機器人框架內核系統。
xy.robot 檔案
...
${Element}= 獲取元素 ID 輸入 UI-tf_Vorgnagsname
按鍵 ${Element} 測驗文本
...
所以我可以在這個輸入欄位中寫入。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/365967.html
