Testcafe: Selector fails on Safari: SyntaxError (DOM Exception 12): The string did not match the expected pattern.

Created on 20 Jun 2018  Â·  2Comments  Â·  Source: DevExpress/testcafe

Are you requesting a feature or reporting a bug?

Bug

What is the current behavior?

Safari fails with SyntaxError (DOM Exception 12): The string did not match the expected pattern.

What is the expected behavior?

Selector should be found

How would you reproduce the current behavior (if this is a bug)?

Try selecting the a element based on data attribute

Provide the test code and the tested page URL (if applicable)

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:

screenshot 2018-06-20 10 18 15

Specify your

  • operating system: Mac OS X 10.13.3
  • testcafe version: 0.20.2
  • node.js version: v8.2.1
  • safari version: 11.0.3
Need clarification

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.

All 2 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Lukas-Kullmann picture Lukas-Kullmann  Â·  3Comments

fnlctrl picture fnlctrl  Â·  3Comments

devmondo picture devmondo  Â·  3Comments

jvanoostveen picture jvanoostveen  Â·  4Comments

xalvarez picture xalvarez  Â·  3Comments