MyBB Internal: One or more warnings occured. Please contact your administrator for assistance.
WebPagetest Forums - iframe cross domain issue

WebPagetest Forums

Full Version: iframe cross domain issue
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone,

I was trying to build the following journey using WPT script and I am unable to fill in the search criteria on step=2. I reckon, this is because the DOM elements belong to a different iframe.

1. Visit http://www.thomascook.com/holidays/city-breaks/
2. Select origin (eg. London)
3. Fill in destination (eg. JFK)
4. Click Search

Any suggestions on how I can set/select values on iFrames in WPT?

Thanks,
Avi
Can you use the contentWindow member of the iFrame and interact with it? Basically, get it working with script in Chrome's F12-dev tools console and then it should work as an exec command.
Thanks Pat, following code works:

Code:
combineSteps
navigate    http://www.thomascook.com/holidays/city-breaks/
execAndWait    document.querySelector("[src='http://ww7.thomascook.com/city-breaks/Iframe.html']").contentWindow.document.getElementsByClassName('custom-select-option')[3].click()
execAndWait    document.querySelector("[src='http://ww7.thomascook.com/city-breaks/Iframe.html']").contentWindow.document.querySelector("[name='airport_selection_panel:arrivalPointContainer:arrivalAirportPanel:inputFra​gment:arrivalPoint']").value = 'JFK'
execAndWait    document.querySelector("[src='http://ww7.thomascook.com/city-breaks/Iframe.html']").contentWindow.document.querySelector("[name='checkInDate']").value = '08/10/14'
ignoreErrors    1
execAndWait    document.querySelector("[src='http://ww7.thomascook.com/city-breaks/Iframe.html']").contentWindow.document.querySelector("[name='searchButton']").click()
Reference URL's