Morgan Allen Morgan Allen - 1 year ago 113
Python Question

Passing a value into a python variable via Splinter

I'm looking at a web page and making a yes/no decision. I'm trying to create a prompt that will allow me to pass the "yes" / "no" to a python variable via Splinter.

1.) Page loads

2.) Execute something like

with a yes/ no to a variable

3.) Some business logic is done based on that variable

ie -

data = browser.execute_script("window.prompt()")
if data == 'yes':
print('the value is good')
print('the value is bad')

Is there a good way to go about doing this?

Answer Source

Is there a good way to go about doing this?

No. Use Python's input (or raw_input if using Python 2), or get that value as a command line argument.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download