From: sto.mar@... Date: 2013-02-01T16:40:21+09:00 Subject: Re: Why Array#include? not working withone liner integer arrays? Am 01.02.2013 08:27, schrieb Arup Rakshit: > Justin Collins wrote in post #1094691: >> On 01/31/2013 11:01 PM, Arup Rakshit wrote: >>> => false >>> irb(main):010:0> [1,2,3].inculde?(1) >>> NoMethodError: undefined method `inculde?' for [1, 2, 3]:Array >>> from (irb):10 >>> from C:/Ruby193/bin/irb:12:in `
' >>> irb(main):011:0> >>> >>> Could you please if is it possible what I am looking for or I did the >>> mistake? >>> >>> Thanks >>> >> >> >> You are misspelling "include" :) >> >> -Justin > > The below should work right Logically ? > > @extension = File.extname(link_text) > driver.find_element(:link, link_text).click if > [".pdf",".gif",".bmg","tif",".tiff","jpeg",".jpg"].include?(@extension) A friendly meant suggestion: Instead of writing posts like this and the previous one you could spend your (and our) time better with attentively reading the error messages, re-reading your code **carefully** and simply trying whether it works on simple examples. This applies here also: ext = 'gif' puts 'an image!' if [".gif", "tif", '.jpg'].include?(ext) # no output ext = 'tif' puts 'an image!' if [".gif", "tif", '.jpg'].include?(ext) # "an image" You have to ask yourself: is the dot supposed to be included in your @extension string or not? --