Michal Škultéty
Michal Škultéty

Reputation: 228

wait for page to load before executing applescipt code in chrome

I have a code in applescript that automatically fills the webform and I want to wait before the page is fully loaded and then proceed with the javascript filling of the form.

Code:

tell application "Google Chrome" to tell active tab of window 1

activate

open location "http://www."

delay 10

execute javascript "document.getElementById('ctl00_ContentPlaceHolder1_personDetails_titleDropDownList').value='Mr '"

Thanks in advance

Upvotes: 0

Views: 259

Answers (1)

IbrahimMitko
IbrahimMitko

Reputation: 1207

I'd add that in a script tag that waits for the page to load. So at the bottom of the page it'd be something like:

<script>
$(document).ready(function() {
    document.getElementById('ctl00_ContentPlaceHolder1_personDetails_titleDropDownList').value='Mr ';
});
</script>

Upvotes: 1

Related Questions