Skip to content

Commit

Permalink
fix(basic.gblib): Fixes in WebAutomation.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Mar 7, 2023
1 parent b576b6f commit d4cf165
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/basic.gblib/services/DialogKeywords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions packages/basic.gblib/services/SystemKeywords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });

Expand Down Expand Up @@ -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;

Expand Down
18 changes: 6 additions & 12 deletions packages/basic.gblib/services/WebAutomationServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 });
Expand Down

0 comments on commit d4cf165

Please sign in to comment.