fix(basic.gblib): Fixes in WebAutomation.

This commit is contained in:
rodrigorodriguez 2023-03-07 12:29:02 -03:00
parent b576b6f54d
commit d4cf165165
3 changed files with 9 additions and 15 deletions

View file

@ -774,7 +774,7 @@ export class DialogKeywords {
await sleep(DEFAULT_HEAR_POLL_INTERVAL);
}
const answer = min. cbMap[userId].promise;
const answer = min.cbMap[userId].promise;
if (!kind) {
result = answer;

View file

@ -475,7 +475,7 @@ export class SystemKeywords {
// Handles calls for HTML stuff
if (handle) {
if (handle && WebAutomationServices.isSelector(file)) {
GBLog.info(`BASIC: Web automation SET ${file}' to '${address}' . `);
await new WebAutomationServices().setElementText({ pid, handle, selector: file, text: address });
@ -718,7 +718,7 @@ export class SystemKeywords {
page = WebAutomationServices.getPageByHandle(handle);
}
if (page['$eval'] && (file.startsWith('.') || file.startsWith('#'))) {
if (page['$eval'] && WebAutomationServices.isSelector(file)) {
const container = page['frame'] ? page['frame'] : page;
const originalSelector = file;

View file

@ -52,18 +52,11 @@ import { SystemKeywords } from './SystemKeywords.js';
* Web Automation services of conversation to be called by BASIC.
*/
export class WebAutomationServices {
/**
* The number used in this execution for HEAR calls (useful for SET SCHEDULE).
*/
hrOn: string;
debugWeb: boolean;
lastDebugWeb: Date;
/**
* SYSTEM account maxLines,when used with impersonated contexts (eg. running in SET SCHEDULE).
*/
maxLines: number = 2000;
static isSelector(name: any) {
return name.startsWith('.') || name.startsWith('#');
}
private debugWeb: boolean;
private lastDebugWeb: Date;
public static cyrb53 = (str, seed = 0) => {
let h1 = 0xdeadbeef ^ seed,
@ -347,6 +340,7 @@ export class WebAutomationServices {
* @example SET page,"selector","text"
*/
public async setElementText({ pid, handle, selector, text }) {
text = `${text}`;
const page = WebAutomationServices.getPageByHandle(handle);
GBLog.info(`BASIC: Web Automation TYPE on ${selector}: ${text}.`);
const e = await this.getBySelector({ handle, selector });