OS: Windows 7 - 64 b
Selenium Version: 3.5.3,
Browser: Chrome 61, 64 b?
Chrome driver: 2.31
Actions mouseOver=new Actions(rwd);
mouseOver.moveToElement(remoteWebElement.findElement("//XpathOfElement")).
build().
perform();
For issues please provide a concise reproducible test case and describe what results you are seeing and what results you expect.
See CONTRIBUTING.md
This also yields the same result when trying to click on an element outside the current visible part of the page.
Can confirm it worked fine before the most recent Chrome update.
Yes, correct. Mouse click and Actions.moteToElement were working fine with Chrome V60 , 64bit.
Let me rewrite the reproducible step.
For issues please provide a concise reproducible test case and describe what results you are seeing and what results you expect.
Don't use narration. Write code.
Try this below code in chrome, firefox, IE browser. But somehow the code is not getting worked. Even though it written properly. It seems like action class is no longer supported by selenium.
In my below code requirement is like I have to hover Main menu "Campuses", After hovering Campuses, sub-menus will be displaying, So, from the sub-menus, I want to click on "Chennai".
See the below attached code for more details.
I am using selenium - 3.5.3
Google Chrome Driver - 2.31
Operating System - Windows 8.1
System.setProperty("webdriver.chrome.driver", "D:\\Jainish\\RND\\Drivers\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("http://www.amity.edu/");
System.out.println(driver.getTitle());
WebElement main_menu = driver.findElement(By.xpath("//ul[@class='megamenu main-nav']/li/a[text()='Campuses']"));
WebElement child_menu = driver.findElement(By.xpath("//ul[@class='megamenu main-nav']//li/a[text()='Chennai']"));
Actions act = new Actions(driver);
new WebDriverWait(driver, 60).until(ExpectedConditions.visibilityOf(child_menu));
act.moveToElement(main_menu).moveToElement(child_menu).click().build().perform();
Can anyone update me regarding this issue?
This sample can't work because
new WebDriverWait(driver, 60).until(ExpectedConditions.visibilityOf(child_menu));
never succeed, child menu is not visible until you move mouse over main menu item.
You have to change the order of instructions:
act.moveToElement(main_menu).perform();
new WebDriverWait(driver, 60).until(ExpectedConditions.visibilityOf(child_menu));
act.moveToElement(child_menu).click().perform();
This code works for me.
The main issue was that, in a scrollable page , moveToElement(), cannot set focus to element which is below of above the visible area. ie, the page has to automatically set focus on the element.
The solution provided by 'barancev' should work, unless the parent has to be scrolled to make it visible.
The issue is not fixed. Cud u please reopen it.
@SwastikGanguly Sorry, I did not catch that it was not your sample of code
Can you please provide me solution of this question.
@jainishkpd Please send questions to the selenium user group
@SwastikGanguly Please provide a concise reproducible test case and describe what results you are seeing and what results you expect.
I guess there is some issue with Actions methods, it is not set focusing the right element. As we can see from comment of 'matt-shepherd', also webdriver.click is not setting focus to right element.
Question is where is the issue - is it the webdriver 3.5.3? or is it in library of selenium java 3.5.3?
@SwastikGanguly Please provide a concise reproducible test case and describe what results you are seeing and what results you expect.
It's too early to make guesses. We can't discuss an issue unless we can reprodice it.
Also take note that moveToElement does not autoscroll, it's a design restriction at present.
Scrolling in Actions should be implemented in W3C WebDriver level 2, see https://github.com/w3c/webdriver/issues/1005
Yes, it clearly mentioned in the question (Selenium 3.5.3) with all latest browsers and with all latest drivers of respective browsers.
Now it points to right direction. Thanks. Let the issue open till level 2 completion, and build and release.
Once we get back the moveToElement i would recomment a closure of issue. Is that ok?
@SwastikGanguly We'll close the issue unless you provide a concise reproducible test case.
If it's related to https://github.com/w3c/webdriver/issues/1005 -- there is no need to keep it open here, the issue should be raised on driver vendor specific trackers.
If it's _not_ related to https://github.com/w3c/webdriver/issues/1005 -- what's the purpose to keep it open at all?
To repo the .Click() below the scroll issue:
var driver = new ChromeDriver();
driver.Navigate().GoToUrl("http://www.bbc.co.uk");
driver.FindElementByClassName("orb-footer-terms").Click();
Expect the browser to navigate to "http://www.bbc.co.uk/usingthebbc/terms/"
Actual result is an exception:
System.InvalidOperationException : unknown error: Element is not clickable at point (457, 9020)
(Session info: chrome=61.0.3163.79)
(Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 10.0.15063 x86_64)
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebElement.Click()
Used to work in prior version of Chrome.
Current horrible work around:
var driver = new ChromeDriver();
driver.Navigate().GoToUrl("http://www.bbc.co.uk");
var element = driver.FindElementByClassName("orb-footer-terms");
driver.ExecuteScript("arguments[0].scrollIntoView()", element);
element.Click();
Its related to 'w3c/webdriver#1005', and the reason to keep it opened, as it was available with webdriver 3.5.2. And it is now not available in webdriver 3.5.3.
Yes we can use ExecuteScript, but what happens to scripts which are already in production. We should not update all , as in future webdriver , we will get this back. What do u say?
@matt-shepherd What chromedriver version do you use? Upgrade to 2.32
@SwastikGanguly You'd better update too, if you're using an outdated driver.
@SwastikGanguly We'll close the issue unless you provide a concise reproducible test case. We can't be sure is it related to something or not unless we have a reproduction scenario.
I see chromedriver 2.31 in - http://docs.seleniumhq.org/download/.
Please share link of chromedriver 2.32.
Let me verify, and then will respond.
Updated the link on the download page: https://github.com/SeleniumHQ/www.seleniumhq.org/commit/90e83edef120937ad5fa3d9d0016e60d65483364
Verified. With chromedriver 2.32 able to click or moveToElement to element by scrolling page automatically. Please go-ahead close. Thanks. 👍
Just want to add to this incase anyone else comes here looking for an answer to the Click() issue.
Appears Chrome changed the way it's interacted with for things like scrolling etc. As a result, ChromeDriver was updated which I can only assume now uses the UserAgent to detect the version, and then performs the scroll how it sees fit. We were setting the UserAgent in the Selenium session, and as a result ChromeDriver couldn't scroll to an element before clicking.
Including the Chrome version in the user agent solved the issue for us:
"--user-agent=Mozilla/5.0 Chrome/61.0.3163 (CI test)"
First, I want to say thanks to @matt-shepherd for his comment after this was closed; that was exactly why I came here, and it explained why I'm seeing what I'm seeing and why updating chromedrive didn't fix my issue when it appears to have fixed everyone else's.
I'm running some tests using Selenium through Chrome, but I'm running them using Chrome's mobile emulation, so my user agent is coming out as Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1. When I run the test through the mobile emulation, Selenium is failing to click items with the same error as in #4685. When I run it without the mobile emulation, my user agent includes the Chrome version like you suggested, and the test runs successfully.
@barancev, should I create a new issue for this?
Code to create the driver to repro the issue I'm seeing (should work with the same BBC test case @matt-shepherd laid out earlier in this thread):
Map<String, String> mobileEmulation = new HashMap<String, String>();
mobileEmulation.put("deviceName", "iPhone 5");
Map<String, Object> chromeOptions = new HashMap<String, Object>();
chromeOptions.put("mobileEmulation", mobileEmulation);
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
WebDriver driver = new ChromeDriver(capabilities);
I thought i would throw in my 2 cents, but my chrome updated to version 61 and all movetoelemet method does nothing, it does not error but it doesn't scroll correctly to the element.
Rolling back to version 60 fixed the issue, also briefly using JS injection worked for some scenarios but not all.
I will need to play with moving to a newer version of the driver will work with chrome 61.
This caused great stress on release day when my tests wouldn't get past the first hurdle, unknown to me my sneaky chrome updated itself.
Driver Upgrade(from 2.28 to 2.32) never resolved the issue for me, still managing with JS injection though its a pain.
@matt-shepherd @MicahLC Looks like the issue with emulated/custom User-Agent strings was resolved in ChromeDriver 2.33.
Hello,
The issue resolved from my side with chrome driver 2.32/2.33.
This being a community, while all agree to close the issue then please
proceed.
Thanks,
Swastik
On Mon, Sep 11, 2017 at 9:34 PM, Alexei Barantsev notifications@github.com
wrote:
For issues please provide a concise reproducible test case
http://sscce.org/ and describe what results you are seeing and what
results you expect.See CONTRIBUTING.md
https://github.com/SeleniumHQ/selenium/blob/master/CONTRIBUTING.md#issue-contributions—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/SeleniumHQ/selenium/issues/4680#issuecomment-328576855,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AL0Rcr_P377Qaf0BZ8uK5hY3qtpVGafYks5shVoogaJpZM4PTZMU
.
I am facing problem in selenium
In my application I have a element where it is scroll able. to scroll that element we have to click and scroll how to do this?