I'm having a bit difficulties with Chrome driver and Selenium, I have selenium.support version 3.141.0, chrome driver version 2.43.0 and Google Chrome version 71.0.3578.98.
During a test run I click on a button which opens a new window, but for some reason the window is blank instead of the site that should have been loaded. I tried to reproduced it manually but it doesn't happen except from test run.
Do you have any explanation or know the reason for this occurrence?
I have had this issue a few times...
What I have found was that the element that I'm trying to click is not the element that actually invokes the rerender to next page...
My solution
So... to get to the parent element I have used the parent method in XPath.
for example, if I am looking for an element with id='x_d' so I use: Window.WaitForElement(By.XPath("//*[contains(#id, 'x')]")).click();
Now the problem is that the Invoker is the parent so to access the parent a I'll use:
Window.WaitForElement(By.XPath("//*[contains(#id, 'x')]//parent :: a")).click();
Hope this helps you!
Related
Google chrome automatically updated to Version 78.0.3904.87 yesterday and i now seem to have a problem with Selenium Webdriver.
When i run my tests in Visual Studio, the click events seem to occur but the expected result on screen does not happen e.g. clicking a link passes through the code (link.Click) successfully with no failure but the link does not get clicked on screen.
When i run the same test in Debug mode and Step Into each section of code it works fine, its as if selenium is running too fast for the browser (i have an implicit wait built in but its irrelevant, the element is there its just not clicking properly). I'm also finding things like sendKeys does not populate the field though it passes through the code successfully, again fine when stepping into it in Debug mode.
I've tried updating my Chromedriver to the version for V78 but this has made no difference
Similar problem here but my issue is not restricted to pdfs only
Chromedriver 78 cant find element in pdf
My team is running into the same issue. The issue seems to be the time between our WebDriverWaits and our Clicks -- the waits seem to be passing through instantaneously in cases they should not and then any Click element call (or action) hovers over what we want to click on but doesn't actually click.
I finally got to the bottom of this with our setup and it turned out to be the --enable-automation flag that seemed to be causing page flickering on page load.
After adding excludeSwitches: ['enable-automation'] to my config it has resolved the issue.
I am automating a website using Selenium.
I have made a Console Application using C# in Visual Studio.
In that I execute a click on an element. The click should open a new window.
But, it doesn't.
If I close the console window to stop the project, the desired window which should have opened on the click, opens up now.
Earlier, this used to work all fine. But this problem has occurred recently. There has been no change in the code.
Browser is Internet Explorer.
Anyone knows what could have caused such a behavior and how to fix it ?
Do the 2 pc have different screen sizes? If the element is not shown on the page, the 1st click will bring you to the element, but not click it.
Our Selenium tests were developed in C# and were running just fine for months but recently we noticed that a number of tests started failing when executed with Firefox WebDriver.
After investigating the test results and executing tests locally we noticed that from time to time clicks on random elements are executed (we can tell because the visual state of the button or the link changes to what looks like a clicked element)
Browser console does not indicated any errors. WebDriver logs show that click was executed.
Will be grateful for any help.
Edit:
Version of Selenium WebDriver - 2.53.0
Versions of Firefox - (tried few) 33.0.1, 43.0.1, 45.0, 46.0.1
Firefox scale 100%
tried with native events on and off
tried with additional implicit waiting before click
You question is not very specific, so I'll try to offer possible ways you can choose to resolving it.
You didn't indicate which driver and browser versions you used. If you didn't observe failures for months ant suddenly they appeared, my first guess would be that FF version you use on test machine(s) got updated (or driver version in tests was changed), and new combination can work differently. I had situation like this when tests behavior changed, updating driver version helped.
Another option would be to try and see which webelements get misclicked more often than others and insert instructions that check if they are displayed before executing actual click.
Also, try to do step-by-step debugging (if you haven't already) and see if you observe wrong clicks then
One thing we've seen in our testing is that if we're clicking around on the VM while a Selenium test is running on our VM, it can actually prevent clicks from going off.
But another thing we've encountered is that the clicks are often not working where they should be, so you can counter this by using JavaScript clicks instead of Selenium.
For elements that fail regularly, switch the element.Click() to a method utilizing the code below:
IJavaScriptExecutor executor = driver as IJavaScriptExecutor;
executor.ExecuteScript("arguments[0].click();", ElementToClick)
So the problem was that click does not work even when clicking manually so we'll be investigating in that direction.
I am using Selenium Web Driver and encountered following exception while trying to click a proper element in web browser: Unable to locate element.
XPaths are 100% correct.
The strange thing is it is working ok when:
In debug mode.
After clicking Continue in VS when exception appears.
When i am moving mouse manually on the screen.
I would be grateful for any help.
EDIT: Thread.Sleep doesnt help. I am trying to click decrease Year button in web calendar. It works first time, but freezes the second time. But the object is still there. So i dont understand how it can be not visible.
The driver is trying to locate the element before it loaded. Try waiting for it before clicking.
wait.Until(ExpectedConditions.ElementIsVisible(By.XPath(path))).Click();
There are a few things you can try:
1-try a selector by ID instead of the xpath. Maybe new elements are being rendered and making the xpath didn't find the element.
2-implement a retry pattern
3-use thread sleep to let the page being full rendered.
I'm developing an addon for IE8+.
Main function:
- when I click the toolbar, it will display a box inside every single page, ex: google.com, bing.com, codeproject.com... by using execScript to execute jQuery.
Therefore, what Im doing is run javascript in the current page.
Everything has done except when that page perform an Pop-up, it doesnt work anymore.
I click the toolbar, nothing happen, but when I look at the pop-up, surprise! has the box which im trying to display. So, I think the current tab and the popup of its is running the same process.
I have change registry key TabProcGrowth to 20, to make sure every single tab run by its own process, but maybe it not work with popup.
sr for my bad english, any suggestion is welcome.
Thanks in advance.
update:
I have changed the way to develop my addon, so I change my question, too. (But any suggestion for the 1st question still very useful for me).
My new question still mention the "execScript" problem.
HOW to execute javascript with every individual tab of IE browser with TabProcGrowth = 0. I need this value set to 0 because I have the timer to request to the server every interval1 (ex: 60s). So if there are more than one processes of IE, the addon will send multi request to server at the sametime.
In my situation now, I set TabProcGrowth to 0. Open IE, open some tabs. Click the toolbar at the newest tab, it works, ofcourse!. But when I click toolbar at the old one, nothing happen. The script still be execute but it takes effect on the newest tab.
It's the big problem for me, resolve this problem, you guys save my life.