Ruby/Selenium value into array -


i need in ruby/selenium

i have few elements on page this:

<a class="name" title="migel" href="/profiles/users/_1324567980000000c/">migel</a> 

i'd give href string value array.

when use "find_element" - ok:

profile = driver.find_element(:xpath, "****").attribute ('href') 

but page contains lot of such elements, , try use

profile_array = driver.find_elements(:xpath, "lbuh-bluh").attribute ('href')  

naturally attribute ('href') dont work array. how can in case?

in general, task in implementing "random click" on page , want collect "href" elements need array, , realize this:

array[srtring1, string2....stringn].sample.click (schematically)

would mapping on elements , href attribute sufficient?

profile_array = driver   .find_elements(:xpath, "lbuh-bluh")   .map { |el| el.attribute('href') } 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -

Why does a .NET 4.0 program produce a system.unauthorizedAccess error on a Windows Server 2012 machine with .NET 4.5 installed? -