From: sto.mar@... Date: 2012-12-13T05:25:31+09:00 Subject: Re: Find element test with webdriver Am 12.12.2012 20:51, schrieb Mattias A.: > Thanks for your answer Joel. I really want to solve this with Selenium > Webdriver even if watir is better. (cannot give up now :)) > > Your array tips dosent work when the element not exists or i maybe I do > something wrong? Expected output below would be "No", but the test fails > and will not complete the run. It complains about the row array = > @driver.find_element(:id, "gbqfqX") Be more specific (provide the error message). > def by_id_array > array = [] The previous line is useless, because `array' is redefined in the following line: > array = @driver.find_element(:id, "gbqfqX") > puts 'No' if array.size == 0 > end > You need to read Joel's answers more carefully, he suggested array = @driver.find_elements(:id, "gbqfba") (mind the plural). --