Search icon visible in site is not getting displayed while running in Synthetics

Search icon is visible when checked in site. However when running via script, I am not able to locate the element.

Screenshot from site:

Screenshot while running script:
There is some icon showing in the left side corner, but the search icon isn’t visible

Is there any possibility of locating the element?

Hey @Shifa.S

It may be that your search bar is being impacted by the window size Synthetics is loading the site in. You should be able to increase the size with this:

browser.window().setSize(WIDTH,HEIGHT) 

So for example, browser.window().setSize(1980,1024)

Alternatively, if your search bar can work by hitting enter/return, you could type that in, using a sequence like this:

$browser.waitForAndFindElement($driver.By.css('mySearchBar'), 3000).then(function(search){
    search.sendKeys('my fancy search term \n');
})

that \n will simulate hitting enter after typing in the search term

2 Likes