Forum Discussion

ashok_natar's avatar
ashok_natar
Occasional Contributor
11 years ago
Solved

CSS with TestComplete

Hi All, 



I am new to web+testcomplete, and here i am trying to use css selector!!! and failed to use it just because of syntax issues, tried debug myself with help of forums but no luck!! 



Kindly help me to use the css selector! 



I am using the testcomplete sample app(http://support.smartbear.com/samples/testcomplete10/weborders/login.aspx)



I tried as



Aliases["browser"]["pageWebOrdersLogin"]["formAspnetform"]["panelLogin"]["Textbox"]["QuerySelectorAll"](input[id="MainContent_username"])["SetText"]("test")

AND 

 Aliases["browser"]["pageWebOrdersLogin"]["formAspnetform"]["panelLogin"]["Textbox"]("INPUT#ctl00_MainContent_username.txt")["SetText"]("test")

AND 

Aliases["browser"]["pageWebOrdersLogin"]["formAspnetform"]["panelLogin"]["Textbox"]("input#ctl00_MainContent_username.txt")["SetText"]("test")

AND

Aliases["browser"]["pageWebOrdersLogin"]["formAspnetform"]["panelLogin"]["Textbox"](input[id="MainContent_username"])["SetText"]("test")



Note:- Yes, we can communicate with the username filed without using the css selector but my objective is learn to use it, please help me on the same

 

I am using the testcomplete sample application for this assignment 

Thanks 

Ashok Natarajan
  • Thanks all for your supports!!! 



    I have found the solution



    css seletor 

    ["QuerySelector"]("INPUT[id='ctl00_MainContent_username']")["Keys"]("test");



    xpath

    ["FindChildByXPath"]("//INPUT[@id='ctl00_MainContent_username']", true);





1 Reply

  • ashok_natar's avatar
    ashok_natar
    Occasional Contributor
    Thanks all for your supports!!! 



    I have found the solution



    css seletor 

    ["QuerySelector"]("INPUT[id='ctl00_MainContent_username']")["Keys"]("test");



    xpath

    ["FindChildByXPath"]("//INPUT[@id='ctl00_MainContent_username']", true);