Phantomjs-switchtomainframe-method

提供:Dev Guides
2020年6月23日 (火) 08:11時点におけるMaintenance script (トーク | 投稿記録)による版 (Imported from text file)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先:案内検索

PhantomJS-switchToMainFrame()

switchToMainFrame()メソッドは、メインフレーム、つまりルートウィンドウを選択します。

構文

その構文は次のとおりです-

var wpage = require('webpage').create();
wpage.switchToMainFrame();

var page = require('webpage').create();
page.open('http://localhost/tasks/framesl', function(status) {
   page.switchToMainFrame();
   console.log(page.frameName);
});

次の output が生成されます。

page2