0

I'm brand new to selenium webdriver for python, and I've run into a problem I can't solve. I've searched for an answer, but didn't see anything. I apologize if I've missed it.

We had the following command in a selenium IDE script:

getEval | window.$("#DestList option").attr('selected','selected')

In my webdriver python script, I made that command look like this:

driver.execute_script("return window.$("#DestList option").attr('selected','selected')")

When I run the python script, whatever line follows the execute_script line gets an error:

SyntaxError: invalid syntax

Which leads me to believe something is missing from my execute_script command. Can someone tell me what might be missing or where I'm going wrong?

thanks in advance for your help and patience.

Ed

1 Answer 1

1

It is just about the quotes inside the script, fix it (tested, worked for me):

driver.execute_script("return window.$('#DestList option').attr('selected','selected')")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.