Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes the script failed with error even I have added "waitForElementVisible" for the element #302

Closed
JackJiaJJ opened this issue Jun 4, 2019 · 5 comments
Assignees

Comments

@JackJiaJJ
Copy link

JackJiaJJ commented Jun 4, 2019

Sometimes the script failed with below error even I have added "waitForElementVisible" for the element I want to click.

Firefox 60.6.2 ESR
selenese-runner: 3.23.0
geckodriver : 0.23.0
selenium: 3.14.59

I got below error:
Command#12: click("linkText=Images")==>[Failure: The element reference of id="scp10" href="images?FORM=Z9LH" is stale; either the element is no longer attached to the DOM, it is not in the current frame context, or the document has been refreshed ....]

@JackJiaJJ
Copy link
Author

{
"id": "b9616ec7-f5a2-474a-8263-20619e0f5bd0",
"version": "2.0",
"name": "test",
"url": "http://www.bing.com",
"tests": [{
"id": "5a602761-37a5-41ea-9b90-1565158a2177",
"name": "wait-for-commands",
"commands": [{
"id": "629fa35a-4e39-41a0-8edb-1195c1717b54",
"comment": "",
"command": "open",
"target": "/",
"targets": [],
"value": ""
}, {
"id": "2d0a9ba7-dcd7-4e08-987e-99dfd1674bce",
"comment": "",
"command": "click",
"target": "id=sb_form_q",
"targets": [
["id=sb_form_q", "id"],
["name=q", "name"],
["css=#sb_form_q", "css:finder"],
["xpath=//input[@id='sb_form_q']", "xpath:attributes"],
["xpath=//form[@id='sb_form']/div/input", "xpath:idRelative"],
["xpath=//input", "xpath:position"]
],
"value": ""
}, {
"id": "ca111baa-ec31-4208-9914-e898102b1487",
"comment": "",
"command": "waitForElementVisible",
"target": "id=sb_form_q",
"targets": [],
"value": "30000"
}, {
"id": "30cb6a3b-a5f7-4992-b295-a8ac4bc7f72e",
"comment": "",
"command": "verifyElementPresent",
"target": "id=sb_form_q",
"targets": [],
"value": ""
}, {
"id": "1bb900f3-ac40-4e68-b3b9-b89ad73e5ecc",
"comment": "",
"command": "waitForElementPresent",
"target": "id=sb_form_q",
"targets": [],
"value": "30000"
}, {
"id": "0c9497b6-5734-4dca-b899-188b6d1dd372",
"comment": "",
"command": "verifyElementNotPresent",
"target": "id=sb_form_q_1",
"targets": [],
"value": ""
}, {
"id": "fa8263ef-b216-4851-90c5-50133a367f81",
"comment": "",
"command": "waitForElementNotPresent",
"target": "id=sb_form_q_1",
"targets": [],
"value": "30000"
}, {
"id": "f72d2d92-e8f1-4711-9919-f0464f32d4b7",
"comment": "",
"command": "verifyNotText",
"target": "id=id_s",
"targets": [
["id=id_s", "id"],
["css=#id_s", "css:finder"],
["xpath=//span[@id='id_s']", "xpath:attributes"],
["xpath=//a[@id='id_l']/span", "xpath:idRelative"],
["xpath=//div[5]/div/div/div/a/span", "xpath:position"],
["xpath=//span[contains(.,'Sign in')]", "xpath:innerText"]
],
"value": "Sign in _ Jack"
}, {
"id": "979e0b2c-07dd-42c9-962c-2525a008414e",
"comment": "",
"command": "waitForElementEditable",
"target": "id=sb_form_q",
"targets": [],
"value": "30000"
}, {
"id": "26fe3e69-9c5e-428c-a06b-7704dd69a8a9",
"comment": "",
"command": "type",
"target": "id=sb_form_q",
"targets": [
["id=sb_form_q", "id"],
["name=q", "name"],
["css=#sb_form_q", "css:finder"],
["xpath=//input[@id='sb_form_q']", "xpath:attributes"],
["xpath=//form[@id='sb_form']/div/input", "xpath:idRelative"],
["xpath=//input", "xpath:position"]
],
"value": "linux"
}, {
"id": "de2bf287-dddf-4018-bd1e-b7c33633ba2e",
"comment": "",
"command": "sendKeys",
"target": "id=sb_form_q",
"targets": [
["id=sb_form_q", "id"],
["name=q", "name"],
["css=#sb_form_q", "css:finder"],
["xpath=//input[@id='sb_form_q']", "xpath:attributes"],
["xpath=//form[@id='sb_form']/div/input", "xpath:idRelative"],
["xpath=//input", "xpath:position"]
],
"value": "${KEY_ENTER}"
}, {
"id": "ff1ca598-4da8-450c-91cf-c17df7e41636",
"comment": "",
"command": "click",
"target": "linkText=Images",
"targets": [
["linkText=Images", "linkText"],
["css=.b_scopebar li:nth-child(2) > a", "css:finder"],
["xpath=//a[contains(text(),'Images')]", "xpath:link"],
["xpath=//header[@id='b_header']/nav/ul/li[2]/a", "xpath:idRelative"],
["xpath=//a[contains(@href, '/images/search?q=linux&FORM=HDRSC2')]", "xpath:href"],
["xpath=//li[2]/a", "xpath:position"],
["xpath=//a[contains(.,'Images')]", "xpath:innerText"]
],
"value": ""
}, {
"id": "539a8cee-cf9a-4102-8871-0b9fa46dc0c0",
"comment": "",
"command": "close",
"target": "",
"targets": [],
"value": ""
}]
}],
"suites": [{
"id": "36185111-87cd-446b-a732-396530702b3a",
"name": "Default Suite",
"persistSession": false,
"parallel": false,
"timeout": 300,
"tests": ["5a602761-37a5-41ea-9b90-1565158a2177"]
}],
"urls": ["http://www.bing.com/"],
"plugins": []
}

@JackJiaJJ
Copy link
Author

Above test can work well on IDE

@JackJiaJJ
Copy link
Author

I got a workaround: add a pause before click the element "linkText=Images"

image

@vmi vmi self-assigned this Jun 4, 2019
@vmi
Copy link
Owner

vmi commented Jun 16, 2019

Hi,

I fixed this problem and released 3.24.0.
Please test it.

@JackJiaJJ
Copy link
Author

It can work well with release 3.24.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants