Selenium Basic + UWSC でポップアップをよろしくする
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>popup2</title>
</head>
<body>
<div id="message">( ‘(I¥‘))</div>
</body>
</html><!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>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()