Forum Discussion

m_essaid's avatar
m_essaid
Valued Contributor
5 years ago

QuerySelector

Hi, I'm new to this feature, I would like to identify an object to use the "SetText()" or "Key()" method on it.   Could Someone tell me what should I write in CSSSelector to identify this object ?...
  • m_essaid's avatar
    5 years ago

    I finally found it :

     

    Sys.Browser().Page('*').QuerySelector('[data-bind="value: sMatricule"]').SetText('test');

  • AlexKaras's avatar
    AlexKaras
    5 years ago

    Hi,

     

    a) Robert is correct with his note. Any reason not to use Aliases.browser.page ?

    b) Exactly as I said (without knowing your tested application details) - button click reloads the page, but your code does not wait for page to load and looks for the object. As the object does not exist yet, the search fails.

    At least, I would recommend to execute

    Aliases.browser.page.Wait()

    after the click to wait for the page to load. Depending on your tested application, additional delays might be required to wait for page scripts and relevant Ajax calls to complete.