0

im trying to pass an integer into an execute javascript statement to use as the index of an array in the javascript. Is this possible and if so how?

set i to 0
tell active tab of win 
    set failedTests to (execute javascript "document.getElementsByClassName('specDetail failed')[i].getElementsByTagName('a')[0].title") as string                  
end tell

1 Answer 1

2

Try:

set i to 0
set jsCommand to "document.getElementsByClassName('specDetail failed')[" & i & "].getElementsByTagName('a')[0].title"

tell application "Google Chrome"
    tell active tab of window 1
        set xxx to execute javascript jsCommand
    end tell
end tell
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.