开发者

Javascript:How to prevent Submit button getting disabled after dynamically inputting form text field?

开发者 https://www.devze.com 2022-12-07 17:39 出处:网络
I am triggering a popup on Swagger UI page load then setting the value of input field of Bearer token.and then wish to click on the \'Authorize\' button programmatically to close the bearer token moda

I am triggering a popup on Swagger UI page load then setting the value of input field of Bearer token.and then wish to click on the 'Authorize' button programmatically to close the bearer token modal(Screenshot below).But the button seems disabled and unless I manually type something in the input it does not get enabled.What could be the issue?

   window.addEventListener('load', function() {
    
        // On Load tri开发者_如何转开发ggers Modal Popup
        const authorizeButton = document.getElementsByClassName('authorize')[0];
        authorizeButton.click();
    
        //Set Input Field
        const abcd = document.querySelectorAll('[aria-label="auth-bearer-value"]');
        abcd[0].value = 'abcd';
    
        abcd[0].dispatchEvent(new Event('change'));
        abcd[0].dispatchEvent(new Event('keydown'));
        abcd[0].dispatchEvent(new Event('keypress'));
        abcd[0].dispatchEvent(new Event('keyup'));
        abcd[0].dispatchEvent(new Event('input'));


       // Need to Click on 'Authorize' button as shown in screenshot but it seems to be disabled
}

Javascript:How to prevent Submit button getting disabled after dynamically inputting form text field?

0

精彩评论

暂无评论...
验证码 换一张
取 消