Selenium: Finding page element in WordPress

Ok, this should be easy, but I cannot seem to figure it out:

How do I identify and access the new post area (from the Dashboard) in WordPress, using selenium in VS/.Net?

Read More

I can access the title field easily by ID, like this:

Driver.Instance.FindElement(By.Id("title")).SendKeys("Sometitle");

But, looking at the page source, I cannot figure out how to access the post body.

In recent versions, I believe, there was an iframe, and it could be accessed like this:

Driver.Instance.SwitchTo().Frame("content_ifr");
Driver.Instance.SwitchTo().ActiveElement().SendKeys(body);

…but this doesn’t work anymore, and looking at the source it seems that this has been changed.

So – does anyone know how to do this in recent versions of WordPress?

EDIT: It turns out that I was wrong; there IS indeed an iframe named “content_ifr”. So the new question is: Why doesn’t the above code work? It’s supposed to switch the focus to the content frame, but it doesn’t.

Related posts

Leave a Reply

1 comment

  1. try

    Driver.FindElement(By.XPath(""));
    

    to find XPath in google chrome right click on element->Inspect element, then click on “Copy XPath”.

    Hope it helps!