1

I am trying to automatically join a meeting on web conferencing software clearslide using nodejs and puppeteer, when i set values of input and try to submit the values disappear and form raises no input value validation error. Looking at the javascript code shows some code monitoring keypresses and evaluating the key. I even tried dispatching keypress events with char codes but that does not work. Need some suggestions how to set values of input correctly. For eg. I tried

await page.evaluate ( (zoomMeetingName, zoomMeetingEmailId) => {
    el = document.getElementById('email');
    etype = 'click';
    if (el.fireEvent) {
        el.fireEvent('on' + etype);
    } else {
        var evObj = document.createEvent('Events');
        evObj.initEvent(etype, true, false);
        el.dispatchEvent(evObj);
        }
        document.getElementById('email').value = zoomMeetingEmailId;
        $("#name").change();
    }, MeetingName, MeetingEmailId);

This fires an click event then sets the value of input for email. The value get set but as soon as i submit or click on any of the inputs are fields get empty. I also try to trigger key press event like this:

var press = jQuery.Event("keypress");
press.which = 70;
press.ctrlKey= false,
press.bubbles= true,
press.altKey= false;
$("body").trigger(press);
$("#email").trigger(press);
3
  • Please edit the question and add more details, including code. Commented Jul 5, 2018 at 6:23
  • @Vaviloff I have added some code Commented Jul 5, 2018 at 21:03
  • 1
    You don't need to imitate keypresses yourself, puppeteer has page.type method, try that. Commented Jul 6, 2018 at 3:08

1 Answer 1

0

You don't need to imitate keypresses yourself, puppeteer has page.type method:

page.type('#mytextarea', 'Hello'); // Types instantly
page.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.