Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium clicks on a wrong link (or does not click on a link at all) on certain machines

I am using Selenium WebDriver 2.5.0 (tried 2.13.0, it did not help). I am trying to click on a link like this:

driver.FindElement(By.PartialLinkText("Customer - Creation").Click();

Before it worked, but I have tried to run the scripts after 3 weeks and I observe 3 different behaviors on 3 machines:

  1. Machine A: There is no click on the link at all, also there is no error.

  2. Machine B: It clicks a different link! Sometimes one above, sometimes one below.

  3. Machine C (Virtual): It works.

I have not fully tested this (spent half a day today), but did anyone stumble upon such a behaviour?

I have restarted my PC, re-added the Selenium libraries. "SendKeys(Enter)" helps, but this issue happened not only to links, but to at least radio boxes as well, where "SendKeys(Enter)" does not work.

Please share your thoughts.

Update: Browsers are the same on at least 2 machines, Internet Explorer 8.0

like image 645
Andrey Avatar asked Nov 24 '11 19:11

Andrey


People also ask

How do I click on a specific link in Selenium?

New Selenium IDE A hyperlink on a page is identified with the anchor tag. To click a link, we can use the link text locator which matches the text enclosed within the anchor tag. We can also use the partial link text locator which matches the text enclosed within the anchor tag partially.

What is Click () method in Selenium?

We can click a button with Selenium webdriver in Python using the click method. First, we have to identify the button to be clicked with the help of any locators like id, name, class, xpath, tagname or css. Then we have to apply the click method on it. A button in html code is represented by button tagname.

Why are elements not clickable?

The exception “Element is not clickable at point” might be thrown when the element is not under focus or the action is being performed on the incorrect WebElement. In such cases, you have to switch to the actual element and perform the click action.


1 Answers

One other thing to check for is the screen resolution (not the desktop resolution but the system level size of text and icons). I have two laptops in my office that are you used for testing, one running Windows 7 and the other running Windows 10. On both, the screen resolution was greater than 100% and Selenium was having problems moving the mouse to the correct location for mouse events like click and hover. As soon as the screen resolution was set to 100%, all mouse actions worked correctly.

Windows 7: http://windows.microsoft.com/en-us/windows7/make-the-text-on-your-screen-larger-or-smaller?v=t

Windows 10: https://superuser.com/questions/951199/windows-10-system-font-size-change

like image 173
Maurice Lepouttre Avatar answered Sep 17 '22 22:09

Maurice Lepouttre