Groups
Groups
Sign in
Groups
Groups
日本Seleniumユーザーコミュニティ
Conversations
Labels
About
Send feedback
Help
ダイアログボックスのスクリーンショット取得について
1,124 views
Skip to first unread message
mori
unread,
Mar 23, 2017, 5:01:14 AM
3/23/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to 日本Seleniumユーザーコミュニティ
度々失礼いたします。
森です。
現在、以下の環境でテストコードを作成しています。
=環境=
OS
・Windows7(32bit)
ブラウザ
・IE10
Java
・java1.8.0
・eclipse4.5.2
・selenium-java-3.1.0
・IEDriverServer(32bit)3.1.0
そこで、ダイアログボックスが表示された状態でスクリーンショットを取りたいのですが、なかなか方法を見つけられず、、、
そもそもダイアログボックスのスクリーンショットの取得は可能なのか、可能であれば、どのようにすればいいのか、アドバイスいただけますと幸いです。
宜しくお願い致します。
現在使用しているコードは以下の通りです。
※driver. switchTo().alert().accept();の前にスクリーンショットのコードを入れても同様に失敗します。
driver.findElement(By.name("*****")).click(); ←ダイアログボックス表示のトリガーです。
WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.alertIsPresent());
driver. switchTo().alert().accept();
File tempFile * = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
try {
FileUtils.moveFile(tempFile*,new File("*****"));
} catch (IOException e) {
// TODO 自動生成された catch ブロック
e.printStackTrace();
}
伊藤望
unread,
Mar 23, 2017, 5:51:16 AM
3/23/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to 日本Seleniumユーザーコミュニティ
森さん
伊藤です。
残念ながらダイアログボックスのスクリーンショットは
Seleniumのスクリーンショット機能ではとれません。
どうしてもということであれば、
JavaのRobotライブラリなどを使って撮れると思います。
http://bhags.org/?p=547
ただし、
- デスクトップ全体の画面キャプチャになると思います。
- マルチモニタでもうまく撮ろうと思うと少し面倒だと思います。
mori
unread,
Mar 27, 2017, 12:38:39 AM
3/27/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to 日本Seleniumユーザーコミュニティ
伊藤さん
森です。
ご回答いただきましてありがとうございます。
機能なしとのこと、、、承知いたしました。
Javaにて対応しようと思います。
ありがとうございました!
2017年3月23日木曜日 18時51分16秒 UTC+9 伊藤望:
Reply all
Reply to author
Forward
0 new messages