File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -108,28 +108,27 @@ export class Search extends Instagram<TSearchResult> {
108108 await this . start ( ) ;
109109 }
110110 try {
111- // Attempt to click search element
112111 try {
113- const inputElement = await this . page . waitForSelector (
114- this . inputElementQuery ,
115- { timeout : 30000 } ,
116- ) ;
117- await inputElement . click ( ) ;
118- } catch ( e ) {
119- await this . page . click ( this . inputElementQuery ) ;
112+ await this . page . waitForSelector ( this . inputElementQuery , {
113+ timeout : 30000 ,
114+ } ) ;
115+ } catch {
116+ // Timeout
120117 }
118+ await this . page . click ( this . inputElementQuery ) ;
121119
122120 await this . page . keyboard . sendCharacter ( this . searchQuery ) ;
123121 await this . page . waitForRequest ( ( req ) => this . matchURL ( req . url ( ) ) ) ;
124122 await this . processRequests ( ) ;
125123 await this . page . waitForResponse ( ( res ) => this . matchURL ( res . url ( ) ) ) ;
126124 await this . processResponses ( ) ;
127- await this . stop ( ) ;
128- return this . searchResult ;
129125 } catch ( e ) {
130126 await this . stop ( ) ;
131127 throw e ;
132128 }
129+
130+ await this . stop ( ) ;
131+ return this . searchResult ;
133132 }
134133
135134 public matchURL ( url : string ) {
You can’t perform that action at this time.
0 commit comments