Skip to content

Commit

Permalink
Fix count in fillForms. Allow it to increment
Browse files Browse the repository at this point in the history
  • Loading branch information
bachdumpling committed Aug 10, 2023
1 parent 78118de commit c44664b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { join } from 'path';
const EMULATE_DEVICE = 'iPhone 13 Mini';

const config: CollectorOptions = {
numPages: 2,
numPages: 1,
headless: true,
emulateDevice: KnownDevices[EMULATE_DEVICE],
// Uncomment to run with desktop/laptop browser
Expand Down
3 changes: 2 additions & 1 deletion src/pptr-utils/interaction-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const fillForms = async (page: Page) => {
console.log('Checking for inputs on the page');
const elements = await page.$$('input');
console.log(`Found ${elements.length} input elements`);
const count = 0;
let count = 0;
for (const el of elements) {
console.log(`Inspecting element ${count}`);
if (count > 100) {
Expand Down Expand Up @@ -86,6 +86,7 @@ export const fillForms = async (page: Page) => {
}
await new Promise(resolve => setTimeout(resolve, 100));
console.log(' .... done');
count += 1;
}
} catch (error) {
console.log(error);
Expand Down

0 comments on commit c44664b

Please sign in to comment.