Last active
April 25, 2016 07:26
-
-
Save stuncloud/768c2d8a2f3cf1732d34d5cfe155d1a8 to your computer and use it in GitHub Desktop.
Selenium Basic + UWSC でポップアップをよろしくする
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>popup1</title> | |
<script type="text/javascript"> | |
var openPopup = function(name) { | |
var feature = 'left=100' | |
+ ',top=100' | |
+ ',height=200' | |
+ ',width=300' | |
+ ',menubar=false' | |
+ ',toolbar=false' | |
+ ',location=false'; | |
console.log(feature) | |
var child = window.open('popup2.html', name, feature); | |
return child; | |
} | |
</script> | |
</head> | |
<body> | |
<input type="button" id="openPopup" value="open popup" onclick="openPopup();"> | |
<a href="popup2.html" target="_blank" id="openNewWindow">popup2</a> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>popup2</title> | |
</head> | |
<body> | |
<div id="message">( ‘(I¥‘))</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
driver = createoleobj("Selenium.ChromeDriver") | |
driver.Start() | |
driver.Get("http://test/popup1.html") | |
button = driver.FindElementById("openPopup") // ポップアップ | |
//button = driver.FindElementById("openNewWindow") // 別ウィンドウ | |
button.Click() | |
driver.SwitchToWindowByTitle("popup2") | |
text = driver.FindElementById("message").Text | |
msgbox(text) | |
driver.Quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment