driver.find_element(:link, link_text).click if
[".docx",".doc",".pdf",".gif",".bmp",".tif",".jpeg",".jpg",".txt"].include?(@extension)
rescue => e
wbs.cells(rows,4).value = link_text
raise
end
end
end
Yes, There is two spaces but How should I handle this on the page,as the
webpage is read only. I am just downloading files which has the
extensions match only. But above mentioned files are not only
downloaded,whereas they present there.
Don’t know why - driver.find_element(:link, link_text).click not
worked when string within the link_text has more than one spaces
between words. But anyway workaround I found is :
link_text.squeeze!(" ").strip! # to remove multiple spaces
If you want multiple spaces in HTML to be displayed as such, you need to
use non-breaking spaces: “ ” in HTML.
Didn’t understand you. BTW link_text is the file names to be downloaded
from the webpage. webpage is from third party. And I managed it by using strip and squeeze. Don’t know why the driver couldn’t find out
with in between multiple spaces.