1
所以我試圖用這個python腳本自動登錄到一個站點。如何使用python填充iframe內的表單
from win32com.client import Dispatch
import win32com.client
import time,ids
IE=Dispatch("InternetExplorer.Application")
IE.Visible=1
IE.Navigate("Source.html")
while IE.ReadyState != 4: # Wait for browser to finish loading.
time.sleep(1)
doc = IE.Document # Get the document.
while doc.readyState != "complete": # Wait for document to finish
time.sleep(1)
doc.Login.USER.value = ids.username
doc.Login.PASSWORD.value = ids.password
doc.Login.submit()
while IE.ReadyState != 4: # Wait for browser to finish loading.
time.sleep(1)
doc = IE.Document # Get the document.
while doc.readyState != "complete": # Wait for document to finish
time.sleep(1)
time.sleep(30)
IE.Application.Quit();
它適用於正常部位正常,但Source.html加載在iframe中的網站。 因此,用戶名和密碼字段在iframe中,我不知道如何在這些字段中輸入數據。
嘗試硒http://seleniumhq.org/ – nosklo 2012-02-09 17:54:51