0

I'm trying to prefill webforms in iframes using Requests. If that can't be done, does anyone have a script I can use that works with webbrowser? I like that it calls the default web browser in just about any system, which is great for my Android applications.

I've tried using splinter, a wrapper to selenium, but it only opens the browser--firefox only--for a second, fills out the iframe, and then automatically closes. Below is my splinter code.

with Browser() as browser:
    browser.visit(url)
    r = browser.find_by_id('inpage_to_email').fill('ben@me.com')

Any help would be greatly appreciated!

2
Contributors
2
Replies
19
Views
2 Years
Discussion Span
Last Post by ben.juarez.773
1

but it only opens the browser--firefox only--for a second, fills out the iframe, and then automatically closes.

I believe this is because the context manager in this case destroys the browser instance the moment it goes out of scope (i.e. as soon as you exit the with block). You can test this out by removing the with block and using your code like:

browser = Browser()
browser.visit(url)
# other stuff

Edited by ~s.o.s~

1

Yeah, I figured it out eventually. Thank you for taking the time to answer the question, btw. I should've come back to answer once I figured it out, so I apologize for that.
So splinter works, but the problem is that it won't work on my android device. Back to the drawing board.
Again, thank you!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.