File tree 1 file changed +9
-7
lines changed
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -108,13 +108,10 @@ export class Search extends Instagram<TSearchResult> {
108
108
await this . start ( ) ;
109
109
}
110
110
try {
111
- const inputElement = await this . page . $ ( this . inputElementQuery ) ;
112
- if ( inputElement === null ) {
113
- const pageContent = await this . page . content ( ) ;
114
- this . logger . error ( "Couldn't find input" , {
115
- content : pageContent ,
116
- } ) ;
117
- }
111
+ const inputElement = await this . page . waitForSelector (
112
+ this . inputElementQuery ,
113
+ { timeout : 30000 } ,
114
+ ) ;
118
115
119
116
await inputElement . click ( ) ;
120
117
await this . page . keyboard . sendCharacter ( this . searchQuery ) ;
@@ -125,6 +122,11 @@ export class Search extends Instagram<TSearchResult> {
125
122
await this . stop ( ) ;
126
123
return this . searchResult ;
127
124
} catch ( e ) {
125
+ const pageContent = await this . page . content ( ) ;
126
+ this . logger . error ( e . message , {
127
+ content : pageContent ,
128
+ } ) ;
129
+
128
130
await this . forceStop ( ) ;
129
131
throw e ;
130
132
}
You can’t perform that action at this time.
0 commit comments