Skip to content

Commit 256a1c9

Browse files
rename elementDisplayed to status and add contributors
1 parent 328f145 commit 256a1c9

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@
1313
"type": "git",
1414
"url": "git+https://github.com/saikrishna321/appium-wait-plugin.git"
1515
},
16-
"author": "",
16+
"contributors": [
17+
{
18+
"name": "Saikrishna",
19+
"email": "[email protected]"
20+
},
21+
{
22+
"name": "Srinivasan Sekar",
23+
"email": "[email protected]"
24+
}
25+
],
1726
"license": "ISC",
1827
"bugs": {
1928
"url": "https://github.com/saikrishna321/appium-wait-plugin/issues"

src/plugin.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export default class WaitCommandPlugin extends BasePlugin {
1010
this.strategy = locatorArgs[0];
1111
this.selector = locatorArgs[1];
1212
await this._find();
13-
await this._elementDisplayed();
1413
originalRes = await next();
1514
retryCount = 0;
1615
return originalRes;
@@ -35,6 +34,7 @@ export default class WaitCommandPlugin extends BasePlugin {
3534
`Element with ${this.strategy} strategy for ${this.selector} selector found.`
3635
);
3736
retryCount = 0;
37+
await this._elementDisplayed(baseUrl);
3838
}
3939
}
4040

@@ -55,17 +55,16 @@ export default class WaitCommandPlugin extends BasePlugin {
5555
return await response.json();
5656
}
5757

58-
async _elementDisplayed() {
58+
async _elementDisplayed(baseUrl) {
5959
this.logger.info(`Checking if ${this.selector} element is displayed`);
60-
const baseUrl = this._constructSessionUrl();
61-
const response = await this.elementDisplayed(baseUrl);
60+
const response = await this.elementDisplayStatus(baseUrl);
6261
if (response.value.error) {
6362
if (retryCount !== this._getTimeout()) {
6463
this.logger.info(
6564
`Retrying to check whether ${this.selector} element is displayed or not`
6665
);
6766
retryCount++;
68-
await this._elementDisplayed();
67+
await this._elementDisplayed(baseUrl);
6968
}
7069
}
7170
if (response.sessionId && response.value === 'true') {
@@ -74,7 +73,7 @@ export default class WaitCommandPlugin extends BasePlugin {
7473
}
7574
}
7675

77-
async elementDisplayed(baseUrl) {
76+
async elementDisplayStatus(baseUrl) {
7877
const response = await fetch(
7978
`${baseUrl}wd/hub/session/${this.driver.sessionId}/element/${this.element}/attribute/displayed`,
8079
{

0 commit comments

Comments
 (0)