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 -

excel vba - VBA Proxy auto-configuration for http requests -

php - phpWord - Tables with borders in headers/footers -