How to handle perform search properly

70 views
Skip to first unread message

Niranjan Rao

unread,
Mar 6, 2024, 1:54:58 PMMar 6
to chrome-debugging-protocol

Greetings,

I've noticed that sometimes (not yet able to figure out exactly when) "DOM.getSearchResults" returns 0 as node id. For example in my sample html, there is a div with id "hello". I see following communication in my logs

{"id":1500,"sessionId":"98CFB1AB7DEA9C2E3037940D91095E9B","method":"DOM.performSearch","params":{"query":"#hello","includeUserAgentShadowDOM":true}}

{"id":1500,"result":{"searchId":"2164267.1","resultCount":1},"sessionId":"98CFB1AB7DEA9C2E3037940D91095E9B"}


{"id":1501,"sessionId":"98CFB1AB7DEA9C2E3037940D91095E9B","method":"DOM.getSearchResults","params":{"searchId":"2164267.1","fromIndex":0,"toIndex":1}}

{"id":1501,"result":{"nodeIds":[0]},"sessionId":"98CFB1AB7DEA9C2E3037940D91095E9B"}


I am trying to figure out when will I get 0 as node id. Based on other events around same time frame, it looks like browser was building the new document tree. Should I just ignore the result of getSearchResults and try my query again or wait for some other events are completed?


Regards,

Niranjan

--
Niranjan Rao | Sr.Architect
he/his
Paymentus
Paymentus Corporation The Real-Time Bill Payment CompanyTM
860 Hillview Court Suite 220 Milpitas CA 95035
www.paymentus.com

Reply all
Reply to author
Forward
0 new messages