0

I am trying to set value in textbox after enabling it forcefully through javascript executor in my Selenium (Ruby binding) automation script.

input_fieldcar1 = browser.find_element(:xpath, "/html/body/div[5]/div/div[3]/div[2]/div[2]/div/div/div/div/div[2]/div[2]/div/div/div/div[2]/div/div/div[5]/div/div[2]/div[2]/div/div/div/div[4]/div/div/div[3]/div/div/input")
browser.execute_script('arguments[0].removeAttribute("disabled");', input_fieldcar1)

I tried

input_fieldcar1.send_keys"7"

browser.execute_script('arguments[0].setAttribute("innerHTML","1");', input_field1)

but none of these work!

Also the script ends peacefully without throwing an error etc.

What could be missing / wrong?

1 Answer 1

1

Since it's a textbox, so maybe give value attribute a go?

browser.execute_script('arguments[0].value = "1";', input_field1)
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.