March 2021 - Digital Tool Factory blog March 2021 - Digital Tool Factory blog

The Digital Tool Factory Blog

More Test Cafe Goodies

Generating a random string in some logical order

const setValue = ClientFunction(() => {
var dt = new Date();
var dateString =”Steve French Test – ” + dt.getTime();
document.querySelector(‘input[name=”ctl00$CPHSIURate$txtRiskName”]’).value =dateString;
document.querySelector(‘input[name=”ctl00$CPHSIURate$txtRiskName”]’).dispatchEvent(new window.Event(‘change’, { bubbles: true }))
});

await setValue();

as well as

const setValue = ClientFunction(() => { document.querySelector(‘input[name=”CaptchaAgentValueAsSupplied”]’).value = document.querySelector(‘input[name=”CaptchaAgentValue”]’).value;});
await setValue();

to play with dates

const setValue = ClientFunction(() => { var dt = new Date(); dt.setDate( dt.getDate() – 10 ); var dateString = ((dt.getMonth() > 8) ? (dt.getMonth() + 1) : (‘0’ + (dt.getMonth() + 1))) + ‘/’ + ((dt.getDate() > 9) ? dt.getDate() : (‘0’ + dt.getDate())) + ‘/’ + dt.getFullYear(); document.querySelector(‘input[name=”ExpirationDateOfPriorCoverage”]’).value =dateString; document.querySelector(‘input[name=”ExpirationDateOfPriorCoverage”]’).dispatchEvent(new window.Event(‘change’, { bubbles: true }))});
await setValue();


01
Mar 21


Written By Steve French

 




Copyright 2011 Digital Tool Factory. All Rights Reserved. Powered by raw technical talent. And in this case, WordPress.