動作確認
ここではテストコードを実行するためにRubyプロジェクトを新規作成します。
メニューバーから[ファイル] - [新規(N)] - [Rubyプロジェクト]を選択します。以下のダイアログが表示されるので、[次へ]ボタンを押下します。
![ruby_dousa_1](https://www.seleniumqref.com/images/intro/ruby_dousa_1.png)
任意のプロジェクト名を入力し[完了]ボタンを押下します。
![ruby_dousa_2](https://www.seleniumqref.com/images/intro/ruby_dousa_2.png)
作成されたプロジェクトを右クリックし、[New Form Template] - [Ruby]を選択します。
![ruby_dousa_3](https://www.seleniumqref.com/images/intro/ruby_dousa_3.png)
テストコード記述用のファイル名を入力し、[完了]ボタンを押下します。
![ruby_dousa_4](https://www.seleniumqref.com/images/intro/ruby_dousa_4.png)
ファイルが作成されたので、以下のようにテストコードを記述します。
require 'selenium-webdriver'
# Firefoxを起動
driver = Selenium::WebDriver.for(:firefox)
# 指定したURLに遷移
driver.get('https://www.google.co.jp/')
それでは、動作確認のためにSeleniumのテストを実行してみます。テストの実行はテストコードを記述したファイル(ここではTest_Ruby.rb)を右クリック - [実行] - [Ruby アプリケーション]を選択します(下図参照)。Firefoxが立ち上がりGoogleTopページに遷移すれば正常に動作しています。
![ruby_dousa_5](https://www.seleniumqref.com/images/intro/ruby_dousa_5.png)
以上でSelenium Rubyの環境構築は完了となります。
前のページへ
Fatal error: Uncaught Google_Service_Exception: Error calling GET https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3A138132118&start-date=7daysAgo&end-date=yesterday&metrics=ga%3Apageviews&dimensions=ga%3ApageTitle%2C+ga%3ApagePath&sort=-ga%3Apageviews&max-results=1000: (403) User does not have sufficient permissions for this profile. in /home/users/1/monda-muki/web/seleniumqref.com/google-api-php-client-1-master/src/Google/Http/REST.php:110
Stack trace:
#0 /home/users/1/monda-muki/web/seleniumqref.com/google-api-php-client-1-master/src/Google/Http/REST.php(62): Google_Http_REST::decodeHttpResponse(Object(Google_Http_Request), Object(Google_Client))
#1 /home/users/1/monda-muki/web/seleniumqref.com/google-api-php-client-1-master/src/Google/Task/Runner.php(174): Google_Http_REST::doExecute(Object(Google_Client), Object(Google_Http_Request))
#2 /home/users/1/monda-muki/web/seleniumqref.com/google-api-php-client-1-master/src/Google/Http/REST.php(46): Google_Task_Runner->run()
#3 /home/users/1/monda-muki/web/seleniumqref in /home/users/1/monda-muki/web/seleniumqref.com/google-api-php-client-1-master/src/Google/Http/REST.php on line 110