Bug
Safari fails with SyntaxError (DOM Exception 12): The string did not match the expected pattern.
Selector should be found
Try selecting the a element based on data attribute
Tested page URL: https://codepen.io/anon/pen/vrdjJB
Test code
import { Selector } from 'testcafe';
fixture `Safari Selector Issue`
.page('https://codepen.io/anon/pen/vrdjJB');
test(`Selector fails with "The string did not match the expected pattern"`, async t => {
let iframe = Selector('iframe.result-iframe');
let countryLink = Selector('a[data-suggestion="Country"');
await t
.wait(10000)
.switchToIframe(iframe)
.click(countryLink);
});
It all works on Chrome (67.0.3396) and Firefox (58.0.0) but fails on safari with:
testcafe safari ./tests/safari.ts
Using locally installed version of TestCafe.
Running tests in:
- Safari 11.0.3 / Mac OS X 10.13.3
Safari Selector Issue
✖ Selector fails with "The string did not match the expected pattern"
1) An error occurred in Selector code:
SyntaxError (DOM Exception 12): The string did not match the expected pattern.
Browser: Safari 11.0.3 / Mac OS X 10.13.3
8 | let countryLink = Selector('a[data-suggestion="Country"');
9 |
10 | await t
11 | .wait(10000)
12 | .switchToIframe(iframe)
> 13 | .click(countryLink);
14 |});
15 |
If I execute document.querySelector('a[data-suggestion="Country"]') straight in safari console, it works:

Hi @gytisgreitai! Looks like you've missed ] in the Selector expression (line 8 in the test, take a look a the error stack trace). Please, correct the mistake, and then feel free to reopen the issue if it don't fix the problem.
uh so sorry, I was sure I've double checked everything. Working fine
Most helpful comment
Hi @gytisgreitai! Looks like you've missed
]in the Selector expression (line 8 in the test, take a look a the error stack trace). Please, correct the mistake, and then feel free to reopen the issue if it don't fix the problem.