Selenium WebDriver, works fine on laptop but not on desktop.WHY?

718 Views Asked by At

I'm using Selenium Webdriver latest version and run the test on Chrome v69.0.3497.100.

When I execute script in my laptop, It working fine and click on the element but on desktop, it find element but can't click.

This is HTML of element:

<div class='col-sm-1'>
   <div style="position: relative;margin-top: 19px;left:14px;" class="material-switch">
   <input id="checkHiddenDevice" name="checkHiddenDeviceOption" type="checkbox">
      <input id="checkHiddenDevice" name="checkHiddenDeviceOption"  type="checkbox">
      <label for="checkHiddenDevice" class="label-primary">
      ::before
      ::after
      </label>
   </div>
</div>

This is the Xpath:

//div[@class='col-sm-1']

I've also tried some xpaths like //label[@for='checkHiddenDevice'] or find element by CSS but it doesn't work. only xpath //div[@class='col-sm-1'] is working but in laptop only.

Then I try on KatalonRecorder Tool. When I put my Xpath and run, test case passed because it finds element but didn't click? Then I try to find Xpath by Katalon tool then Katalon generate this Xpath:

xpath=(.//*[normalize-space(text()) and normalize-space(.)='#of devices'])[1]/following::label[1]

But with this xpath it also can't find element (or I don't know how to change it to right xpath in my code)

Does anyone was faced with such problem?

1

There are 1 best solutions below

0
On

Yes.. Even i have faced this issue, this issue might occur when the browser zooming is more than 100%. just execute the same scripts with 90% of browser zoom