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内にあり、データの入力方法はわかりません。
tryセレンhttp://seleniumhq.org/ – nosklo