I am not able to click on the button, how you can see on the picture. This menu is visible, when you click on Tabellen button in the main menu. It is working manually, but when I try my selenium code, it is not working. I try different type of select it, I tried also waits. I tried xpath, cssSelector, ID. What is strange, selenium just click Tabellen button from main menu, but that menu after that just blink and nothing happen.
Please use this example. You need to correct XPath if I have made a mistake.
driver.find_element_by_xpath('//*[text()="Tabellen"]').click()
time.sleep(5)
driver.find_element_by_xpath('//*[text()="Tabellen"]//*[text()="Standorte"]').click()
Related
In the following ecommerce site "https://www.gittigidiyor.com/", I want to click on "giris yap" button using selenium java but the problem is whenever I hover the mouse to profile icon, this pop-up appears and i try to inspect the pop-up to see the element but nothing happened. Could you please help me how can i click the buttons of this pop-up. I tried by switching to alert/frame but it did not workopened login popup in the site
driver.get("https://www.gittigidiyor.com")
driver.findElement(By.cssSelector("[title=\"Giriş Yap\"]")).click()
WebDriverWait wait = new WebDriverWait(driver,30);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("[data-cy=\"header-login-button\"]"))).click();
To find the element use below technique:
To search xpath of such dynamic elements use DOM break points:
And select break on subtree modification. Now all changes will break and pause the webpage rendering
Click resume execution or press f8 till your span gets displayed
I have a code where it is identifying the button but not able to click on it ,may be because it is not in view.If we scroll it clicks.Can selenium click which is out of view
If element is on the page but not on the screen, selenium should click it without problems. Maybe your button is not on page at time of click?
I think it depends on the library you are using. E.g. nightwatch tries to scroll the element into view before clicking
.click()
Suggest edits
Simulates a click event on the given DOM element. The element is scrolled into view if it is not already pointer-interactable. See the WebDriver specification for element interactability.
https://nightwatchjs.org/api/commands/#click
I believe Mink2Selenium does not.
but if the element is not reachable by scrolling, selenium will not be able to click it, same as a user would not be able to click it. What is good, because selenium is used to do as much as possible realistic tests
I want to click on the continue button. But when I am trying to do that it is hitting the Cancel button. When I am taking the xpath for continue button and hitting chrome console, its showing the continue button. But in selenium or protractor its hitting the cancel button.
for protractor try this, should work correctly
element(by.buttonText('Continue!')).click();
Use ccs selector:
element(by.css(’button.confirm’))
Select the element by css and click it:
element(by.css(".confirm")).click();
If all else fails try xpath, do note it'll of course be brittle if your application is multi-lingual
element(by.xpath("//*[text()='Continue']")).click();
I want to open cric info and then click on 'live score'menu when the submenu opens, click on 'Desktop scoreboard'.
But the problem is live score menu is under a div which is hidden.
ie and this div is under td
"You can check the structure of the page to get detailed info"
so when i try to click the menu element using driver.findElementBy("xpath") i got the element not visible exception.
So i directly used the javascript used by the developer mopen('m2') which does the job of opening the menu but after this when i execute the command to find the submenu element again get the same error"Element not visible exception".
Tried making div visible by executing jscript.
PFB the code i used:
FirefoxDriver d1=new FirefoxDriver();
d1.get("http://www.cricinfo.com");
((JavascriptExecutor) d1).executeScript("mopen('m2')");
((JavascriptExecutor) d1).executeScript("document.getElementById('m2').style.visibility='visible';");
((JavascriptExecutor) d1).executeScript("document.getElementById('m2').style.display='block';");
d1.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
d1.findElementByXPath("//*[#id='mgDdRht']/tbody/tr[3]/td/a").click();
Also tried using the Actions class but everything in vain ,help is really appreciated
Thanks in advance.
You should be able to do this with an Action chain:
Actions builder = new Actions(d1);
Action clickSubMenu = builder.moveToElement(d1.findElement(By.cssSelector(".Nav td:nth-child(2).navLinks")))
.moveToElement(d1.findElement(By.cssSelector("#m0 td:nth-child(1)#mgDd>table:nth-child(1)>tbody:nth-child(1) td:nth-child(2).PopupTabs")))
.click(d1.findElement(By.xpath("//*[#id='mgDdRht']/tbody/tr[3]/td/a"))).build();
clickSubMenu.perform();
I tested this in c#, and it worked for me. I translated it to Java, but I may have made a syntactical error. Apologies if I have.
What I found is that I needed to move to Series. Then I had to move to Series - the dropdown version, as the dropdown version of Series is a different element than the non-dropdown version. Then I was able to move to the West Indies link, and click it.
I use Selenium to test some web-product in my company.
Product has button, which open dialog to choose color. I think it's created using 'extJS' (I'm not so sure).
But then i click to any part of that button, using Webdriver, it's always just set current selected color, but newer opened dialog window to select color.
I found similar button on some random site, which has similiar behavior.
Link to site with button on developer.yahoo.com
So in source of the page you can see, that there is no specific element for right part of button, with down-oriented arrow.
So xPath
//*[#id='color-picker-button']
describe button in all,right part and left part.
But every child element of this describe only left part of this button, so right part with arrow has no any specific xPath to click in my WebDriver text.
I also tried things like
driver.action.move_to(element, coordinate_right, coordinate_down).perform
but it has no effect for me.
So in general my question is :
How to open color selector window on that Yahoo page
Use the SendKeys() method and send the "down arrow" key to the control (C#):
element.SendKeys(Keys.ArrowDown);
That should open it right up.