Forum Discussion

mkonkolowicz's avatar
mkonkolowicz
Occasional Contributor
13 years ago

Changing Default Search

hello, 



Just wondering if anyone has used testcomplete to change the default search providers in IE, FF & CH. I'm basically trying to switch between the search engines used for a search through the address bar of the browser.  I'm thinking about how to do this, and currently the only way I can come up with is through the gui's of the browsers. I'm a little leary to accomplish my goal this way, and would like to get some input with respect to any other possible solutions.



  • Hi Maciej,



    In Test Complete 9 and newer you can access Firefox preferences from scripts this way:



    Sys.Browser("firefox").Preferences.<PREFERENCE> = <VALUE>



    To know what you have to change, just open firefox in "about:config" page and click the button, don't worry about the message. Search for the keyword "search", and you will find all preferences that match that keyword.



    Now, pick the preference you want to change (in your case it could be "browser.search.defaultenginename" and set the value you want by replacing it in the previous code:



    Sys.Browser("firefox").Preferences.browser.search.defaultenginename = "Bing"



    I'm not sure if Internet Explorer and Chrome support something like that, could you tell us please?



    Hope it helped!