Okay! Thanks. You are awesome. Okay with "selenium-webdriver" is it
possible to close some pop-up browser which are unwanted, using their
'titles' or anything else?
I meant go look up the MIME type of the file you're having trouble with,
then add that specific one. It'll help you understand what you're
dealing with, rather than taking a scattershot approach.
Is it possible to pause the next set of statements until the download is
not being finished?
A serious problem I am having during download of files:
In the webpage there is file : "Christopher Herman BR.bmp"
But after the download I am getting two files namely -
"Christopher Herman BR.bmp" and "Christopher Herman BR.bmp.part" -- this
is the reason original file getting corrupted. How such `.part` file is
coming?
#Find the newest file
difference = [1,2] - here why you took size 2 of array?
until difference.size == 1 - why 1?
difference = Dir.entries(@download_directory) - @current_downloads -- in
Almost everything can be done differently. You just have to tailor the
code to suit your way of thinking and your specific task.
As for the "best" way to do something, that will always depend on your
objectives - Do you want it... easy to make, easy to use, easy to
expand, immutable, versatile, limited, fast to run, intelligent enough
to correct user errors, etc.
This is why we "play" with code. It's the way you'll discover new
things, sometimes approaches no one else has ever thought of
OMG! Still not working.
Dir.chdir("C:/Documents and Settings/rakshiar/My
Documents/userdata/Rubydownloads") do
until Dir.glob('**/*.part*')[0] !=
sleep 0.1 #puts "h"
end
Any better solution? It seems this couldn't stop the execution of next
line,until the download finished.
I also have seen that,during download of the file - "Christopher Herman
BR.bmp" , two target folders created. The file size is 1.02 MB.
You'd probably write a separate function to determine the most recent
file, wait for its size to stop changing, and then rename it.
Does latest version of "selenium-webdriver" would support such
autodownload functionality. To achieve this what-else gems we need to
download, exepect 'selenium-webdriver'.
Your quick help will be appreciated always. I am currently now
developing such a script.
Thanks,
Please aboid my last comment. Thank you very much to share this. But
after downloading the window is not closed- talking about the
"Downloadable" window.
How to close that- please advice me. As I need to download 600 files
from the browser with that script.
I did not follow this thread, but I am pretty sure that
the condition you are using does not test correctly what
you want to find out.
Consider that Dir.glob returns an array of filename strings,
so that your condition *always* is true. (The first element
will never be an empty array).
A tiny change to the code will fix this...
Furthermore, assuming that you want to sleep as long as
the partial file *does* exists, you would also have to
use `while' instead of `until' (or invert the condition).
General tip: test the code snippet in isolation (using irb),
with files you create or delete manually.
···
Am 01.02.2013 11:49, schrieb Arup Rakshit:
OMG! Still not working.
Dir.chdir("C:/Documents and Settings/rakshiar/My
Documents/userdata/Rubydownloads") do
until Dir.glob('**/*.part*')[0] !=
sleep 0.1 #puts "h"
end
Any better solution? It seems this couldn't stop the execution of next
line,until the download finished.
Any better solution? It seems this couldn't stop the execution of next
line,until the download finished.
I did not follow this thread, but I am pretty sure that
the condition you are using does not test correctly what
you want to find out.
Consider that Dir.glob returns an array of filename strings,
so that your condition *always* is true. (The first element
will never be an empty array).
A tiny change to the code will fix this...
Furthermore, assuming that you want to sleep as long as
the partial file *does* exists, you would also have to
use `while' instead of `until' (or invert the condition).
General tip: test the code snippet in isolation (using irb),
with files you create or delete manually.
Yes! Exactly this I have followed and made the code working: One change
I did-
until Dir.glob('**/*.part*')==
sleep 0.1 #puts "h"
end
Now all are set, for GOD sake:) Thanks to all of you! You people are
really love Ruby- which is proved by your continuous suggestions. It
seems I started to fall in love with "Ruby"