Forum Discussion

AshokKumarSahoo's avatar
AshokKumarSahoo
Contributor
7 years ago

Any one pls share me vbscript code to launch chrome with disable web security mode?

 Test complete will identify the object on chrome browser if  i launch chrome in disable web security mode.But through script i am not able to launch chrome in disable web security mode.Any help please?

 

Thanks & Regards,

Ashok

 

 

4 Replies

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    You can specify command-line arguments for a browser in the RunOptions before running the browser. Note that --disable-web-security also requires --user-data-dir=<ProfilePath>.

    Browsers.Item("chrome").RunOptions = "--disable-web-security --user-data-dir=""C:\Chrome test session"""
    Call Browsers.Item("chrome").Run("https://smartbear.com")

    More info: Launching Browsers

    • AshokKumarSahoo's avatar
      AshokKumarSahoo
      Contributor

      HKosovaThank you for your reply.I tried to use your code ,but it's not working for me.Please refer below screen shot for your reference.could you please guide me what might be the reason for this error.I would love your code which you used 'Runoptions' property.could you please explain more on <profile path> on this parameter arguments.Thanks.

       

       

      Thanks & Regards,

      Ashok

  • sanjay0288's avatar
    sanjay0288
    Frequent Contributor

    Create a shortcut to your chrome, and then in the shortcut properties add the parameter --disable-web-security at the end of the chrome executable path and then run this shortcut through testcomplete

    • AshokKumarSahoo's avatar
      AshokKumarSahoo
      Contributor

      sanjay0288 Thank you.I thought this way.however this way will not work one system to another system.One more issue  if same icons are available on taskbar and start  menu,then test complete will run chrome as normal mode.

       

      I deleted all chrome icons in my system except  icon on desktop and used below codes ,Its working fine.

       

      StrURL="http://XXXXX"
      Set ObjShell = CreateObject("Wscript.Shell")
      ObjShell.Run "C:\Users\username\Desktop\Chrome64_48.0.2564.109\chrome.exe --disable-web-security"
      wait(2)
      ObjShell.sendkeys(StrURL)
      sys.Keys "[Enter]":wait(1)

       

       

      Thanks & Regards,

      Ashok