new(whatsapp.gblib): New provider.

This commit is contained in:
Rodrigo Rodriguez 2022-06-14 11:38:45 -03:00
parent 1d732e08bf
commit 90cf855810
2 changed files with 30 additions and 3 deletions

View file

@ -218,6 +218,27 @@ export class DialogKeywords {
]); ]);
} }
/**
* Returns the screenshot of page or element
*
* @example file = SCREENSHOT page
*/
public async getTableData(step, page, selector) {
const data = await page.evaluate(() => {
const rows = document.querySelectorAll(`${selector} tr`);
return Array.from(rows, row => {
const columns = row.querySelectorAll('td');
return Array.from(columns, column => column.innerText);
});
});
//You will now have an array of strings
//[ 'One', 'Two', 'Three', 'Four' ]
console.log(data);
}
/** /**
* Returns the screenshot of page or element * Returns the screenshot of page or element

View file

@ -525,6 +525,12 @@ export class GBConversationalService {
let currentCaption = ''; let currentCaption = '';
let currentEmbedUrl = ''; let currentEmbedUrl = '';
let conversationId = null;
if(step ){
conversationId = step.context.activity.conversation.id;
}
//![General Bots](/instance/images/gb.png) //![General Bots](/instance/images/gb.png)
for (let i = 0; i < text.length; i++) { for (let i = 0; i < text.length; i++) {
const c = text.charAt(i); const c = text.charAt(i);
@ -559,7 +565,7 @@ export class GBConversationalService {
if (!mobile) { if (!mobile) {
await step.context.sendActivity(currentText); await step.context.sendActivity(currentText);
} else { } else {
await this.sendToMobile(min, mobile, currentText, step.context.activity.conversation.id); await this.sendToMobile(min, mobile, currentText, conversationId);
} }
await sleep(3000); await sleep(3000);
currentText = ''; currentText = '';
@ -579,7 +585,7 @@ export class GBConversationalService {
if (!mobile) { if (!mobile) {
await step.context.sendActivity(currentText); await step.context.sendActivity(currentText);
} else { } else {
await this.sendToMobile(min, mobile, currentText, step.context.activity.conversation.id); await this.sendToMobile(min, mobile, currentText, conversationId);
} }
await sleep(3000); await sleep(3000);
} }
@ -612,7 +618,7 @@ export class GBConversationalService {
if (!mobile) { if (!mobile) {
await step.context.sendActivity(currentText); await step.context.sendActivity(currentText);
} else { } else {
await this.sendToMobile(min, mobile, currentText, step.context.activity.conversation.id); await this.sendToMobile(min, mobile, currentText, conversationId);
} }
await sleep(2900); await sleep(2900);
} }