appium: Appium Select-> Click activates the next (incorrect) element. BUG!
The problem
There’s a problem with find(xpath) click. The wrong element is activated! Selenium for other devices is fine.
Environment
- Appium version 2.0.0
- Desktop OS/version used to run Appium: Gitpod
- Node.js version (unless using Appium.app|exe): v16.13.0
- Npm or Yarn package manager: none
- Mobile platform/version under test: iOS
- Real device or emulator/simulator: real iPad
- Appium CLI or Appium.app|exe: SauceLabs
Details
The problem has been reduced to the above, click() activates the wrong element!
Link to Appium logs
The Log GIST my full Appium log.
Code To Reproduce Issue [ Good To Have ]
await driver.get("http://practisemaster.com/demos/chronoHMStest.html");
let elements = await driver.findElements(By.xpath('//div[@id="bob"]/input[@name="startHours"]'));
for(let e of elements) {
console.log('child name: ' + await e.getAttribute("name"));
var parent = e.findElement(By.xpath('./..'));
console.log('parent ID: ' + await parent.getAttribute('id'));
}
await driver.findElement(By.xpath('//div[@id="bob"]/input[@name="startHours"]')).click();
console.log('Actual active element: ' + await driver.executeScript('return document.activeElement.parentElement.id'));
The result is ‘jane’ which is incorrect, it should be ‘bob’. On Selenium for other devices the result is fine. Jane is the next div after bob .
The js rendered html for the two controls:
<p>Bob:</p>
<div id="bob" data-univhms="" class="timeCase">
<input type="number" class="sH D2 ts_digit" name="startHours" data-tp="1" min="-1" max="100" value="00">
<span class="bds">:</span>
<input type="number" class="sM D2 ts_digit" name="startMinutes" data-tp="2" min="-1" max="60" value="00">
<span class="bds">:</span>
<input type="number" class="sS D2 ts_digit" name="startSeconds" data-tp="3" min="-1" max="60" value="00">
<span class="bds">.</span>
<input type="number" class="sMS D3 ts_digit" name="startMilliSecs" data-tp="4" min="-10" max="1010" step="10" value="000">
<div id="svgContainer">
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fal" data-icon="stopwatch" class="svg-inline--fa fa-stopwatch fa-w-14" role="img" viewBox="0 0 448 512">
<path xmlns="http://www.w3.org/2000/svg" fill="currentColor" d="M393.9 184l22.6-22.6c4.7-4.7 4.7-12.3 0-17l-17-17c-4.7-4.7-12.3-4.7-17 0l-20.7 20.7c-31.1-27.5-70.4-45.9-113.8-50.8V48h28c6.6 0 12-5.4 12-12V12c0-6.6-5.4-12-12-12H172c-6.6 0-12 5.4-12 12v24c0 6.6 5.4 12 12 12h28v49.4C96.4 109.3 16 197.2 16 304c0 114.9 93.1 208 208 208s208-93.1 208-208c0-44.7-14.1-86.1-38.1-120zM224 464c-88.4 0-160-71.6-160-160s71.6-160 160-160 160 71.6 160 160-71.6 160-160 160zm12-112h-24c-6.6 0-12-5.4-12-12V204c0-6.6 5.4-12 12-12h24c6.6 0 12 5.4 12 12v136c0 6.6-5.4 12-12 12z"></path>
</svg>
</div>
</div>
<p>Jane</p>
<div id="jane" data-univhms="" class="timeCase">
<input type="number" class="sH D2 ts_digit" name="startHours" data-tp="1" min="-1" max="100" value="00">
<span class="bds">:</span>
<input type="number" class="sM D2 ts_digit" name="startMinutes" data-tp="2" min="-1" max="60" value="00">
<span class="bds">:</span>
<input type="number" class="sS D2 ts_digit" name="startSeconds" data-tp="3" min="-1" max="60" value="00">
<span class="bds">.</span>
<input type="number" class="sMS D3 ts_digit" name="startMilliSecs" data-tp="4" min="-10" max="1010" step="10" value="000">
<div id="svgContainer">
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fal" data-icon="stopwatch" class="svg-inline--fa fa-stopwatch fa-w-14" role="img" viewBox="0 0 448 512">
<path xmlns="http://www.w3.org/2000/svg" fill="currentColor" d="M393.9 184l22.6-22.6c4.7-4.7 4.7-12.3 0-17l-17-17c-4.7-4.7-12.3-4.7-17 0l-20.7 20.7c-31.1-27.5-70.4-45.9-113.8-50.8V48h28c6.6 0 12-5.4 12-12V12c0-6.6-5.4-12-12-12H172c-6.6 0-12 5.4-12 12v24c0 6.6 5.4 12 12 12h28v49.4C96.4 109.3 16 197.2 16 304c0 114.9 93.1 208 208 208s208-93.1 208-208c0-44.7-14.1-86.1-38.1-120zM224 464c-88.4 0-160-71.6-160-160s71.6-160 160-160 160 71.6 160 160-71.6 160-160 160zm12-112h-24c-6.6 0-12-5.4-12-12V204c0-6.6 5.4-12 12-12h24c6.6 0 12 5.4 12 12v136c0 6.6-5.4 12-12 12z"></path>
</svg>
</div>
</div>
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 22 (8 by maintainers)
@StephanLuis I’ve finally incorporated a new version of the Selenium atoms into the XCUITest driver. It’s several years newer, so maybe it has a fix for these issues? Please try XCUITest driver 4.34 and let me know how it goes.