save an image with selenium & firefox

后端 未结 5 2054
灰色年华
灰色年华 2021-02-08 19:58

i\'m trying to save an image from a website using selenium server & python client. i know the image\'s URL, but i can\'t find the code to save it, either when it\'s the the

5条回答
  •  春和景丽
    2021-02-08 20:35

    I was trying to accomplish the same task, but the images I wanted to grab were the size of my monitor (wallpaper) -- so the capture screenshot workaround didn't work for me. I figured out a way to do it...

    I've got selenium set up to go to the page I want (which induces all the session goodies) Then I used a program called "Workspace Macro" to loop through the selenium tasks.

    Grab it from here http://www.tethyssolutions.com/product.htm -- they have a trial version, which I think works for 30 runs or something.

    So here's the progression:

    • start firefox
    • open selenium and load test case
    • start it, but quickly pause it.
    • record a macro, which pushes "step" on selenium, then goes over to the firefox window and clicks file->save page as, saves, then stop recording
    • run the macro x times...
    • profit??

    Cheers

提交回复
热议问题