0

I want to test this popup window:

enter image description here

but for spinner I get exception. I tried these codes but non of them worked.

Actions componentProportion = new Actions(driver);
componentProportion.SendKesy(Kesy.Control+"a");
componentProportion.SendKeys(editNumber,"2356").Build().Perform();

When I run this code nothing happens and it also causes problem for new text box(Display Title) code and it doesn't work properly.

//Edit display title
IWebElement editDt = driver.FindElement(By.XPath("//*[@id='cmp_display_title']"));
editDt.Click();
Thread.Sleep(500);
editDt.SendKeys(Keys.Control + "a");
editDt.SendKeys(Keys.Delete);
Thread.Sleep(500);
editDt.SendKeys("hello");

And if I want to use this code:

IWebElement editNumber = driver.FindElement(By.CssSelector("something"));
editNumber.Click();
Thread.Sleep(1000);
editNumber.SendKeys(Keys.Control+"a");

I get this exception:

ElementVisibleException : element not visible

Is there anyway to solve this problem? Thank you for your help.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Alex Ramires
  • 161
  • 3
  • 13

2 Answers2

0

So, since your elements are in frame, in order to be able to work with them you need to switch to that frame first (usually by name)

//Switch to required frame
driver.SwitchTo().Frame("ContentContainer");

// find your elements and do the actions

// This is how you switch to the default page
driver.SwitchTo().DefaultContent();
Anton Angelov
  • 1,705
  • 13
  • 16
-1

As I noticed, you want to replace the display title input text with some new text

In order to clear the text, you dont need to simuale ctrl+a.

Simply, use this code to set new value to your text element :

IWebElement editDt = driver.FindElementById("cmp_display_title");
editDt.SendKeys(""); // clears the text
editDt.SendKeys("your new text");
Efe
  • 800
  • 10
  • 32
  • This one doesn't work. ElementVisibleException : element not visible – Alex Ramires Feb 22 '17 at 22:13
  • You may need find the iframe first, and then switch to that. This may help: http://stackoverflow.com/questions/9607964/selenium-unable-to-access-iframe-and-data-inside-it – Efe Feb 22 '17 at 22:33