Quantcast
Channel: selenium - それマグで!
Viewing all articles
Browse latest Browse all 13

Selenium でモバイルエミュレーション

$
0
0

seleniumでモバイルエミュレーションを使いたい

ChromeのWebDriverでモバイル・エミュレーションを使えれば便利なのに。回線速度とか、画面の回転とか、画面のサイズとか、逐次セットするのは面倒なので、セットになってるモバイル・エミュレーション機能を使えば楽なのに。

と思って調べたら

出来る

caps = Selenium::WebDriver::Remote::Capabilities.chrome(
   "chromeOptions" => {
      "mobileEmulation" => {
         "deviceName" => "Google Nexus 5" }
       }
   )

Capabilitiesのオプションに渡せば出来る。これはRubyなので 設定にアクセスに階層にハッシュをつかうけど、JavaPythonならキーでアクセスですね。mobileEmulation.deviceNameがキーですね。


Viewing all articles
Browse latest Browse all 13

Latest Images

Trending Articles

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>