-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Closed
Labels
I-defectSomething is not working as intendedSomething is not working as intendedI-questionApplied to questions. Issues should be closed and send the user to community resources.Applied to questions. Issues should be closed and send the user to community resources.J-issue-templateApplied to issues not following the template, or missing information.Applied to issues not following the template, or missing information.
Description
What happened?
hi all
I found an issue when creating a regression test using Selenium. Previously, I made a Selenium script for WordPress 6.2 using the same script I used for WordPress 6.5. Specifically, when creating a page, when I wanted to fill in the title with the help of XPath as a selector, for some reason, Selenium could not find the element for the title, and the script failed to execute.
Has anyone experienced this or does anyone know why this could happen? I have tried changing the XPath, adding sleep time, but it still doesn’t work
Thank you
How can we reproduce the issue?
Install WordPress 6.5.5
Create login script for WordPress
Create content script for WordPress, here an example of the ode
here the object repository
public static string POST_TITLE = "//h1[@contenteditable='true' and @aria-label='Add title']";
here is my code to fill the post title
// filled title
_driver.WaitToDisplay(By.XPath(PostObjects.POST_TITLE)).SendKeys(postTitle);
here the page
%%WORDPRESS-DOMAIN%%/wp-admin/post-new.php?post_type=page
here the element targets HTML
<h1 contenteditable="true" class="wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text" aria-label="Add title" role="textbox" aria-multiline="true" style="white-space: pre-wrap; min-width: 1px;"><span data-rich-text-placeholder="Add title" style="pointer-events:none;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;"></span></h1>
Relevant log output
OpenQA.Selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//h1[@contenteditable='true' and @aria-label='Add title']"}
(Session info: chrome=131.0.6778.86); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute)
at OpenQA.Selenium.WebDriver.ExecuteAsync(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.WebDriver.FindElement(String mechanism, String value)
at OpenQA.Selenium.By.<.ctor>b__11_0(ISearchContext context)
at OpenQA.Selenium.By.FindElement(ISearchContext context)
at OpenQA.Selenium.WebDriver.FindElement(By by)
at SeleniumTest.NUnit.Extensions.DriverExtensions.WaitToDisplay(IWebDriver driver, By by, Int32 timeout, Boolean retry) in D:\Laragon\www\domain.cms.php.internal\CWP2.Regression.Test\Wordpress\SeleniumTest.NUnit\Extensions\DriverExtensions.cs:line 58
at SeleniumTest.NUnit.Extensions.DriverExtensions.WaitToDisplay(IWebDriver driver, By by) in D:\Laragon\www\domain.cms.php.internal\CWP2.Regression.Test\Wordpress\SeleniumTest.NUnit\Extensions\DriverExtensions.cs:line 27
at SeleniumTest.NUnit.NF.SeleniumTestSuite._CreateContent(String postTitle, String postBodyContent, String testName) in D:\Laragon\www\domain.cms.php.internal\CWP2.Regression.Test\Wordpress\SeleniumTest.NUnit\SeleniumTestSuite.cs:line 462
at SeleniumTest.NUnit.NF.SeleniumTestSuite.CreateContent() in D:\Laragon\www\domain.cms.php.internal\CWP2.Regression.Test\Wordpress\SeleniumTest.NUnit\SeleniumTestSuite.cs:line 412Operating System
Windows and Ubuntu
Selenium version
.net 6
What are the browser(s) and version(s) where you see this issue?
Chrome
What are the browser driver(s) and version(s) where you see this issue?
ChromeDriver 131.0.6778.87/win32
Are you using Selenium Grid?
No response
Metadata
Metadata
Assignees
Labels
I-defectSomething is not working as intendedSomething is not working as intendedI-questionApplied to questions. Issues should be closed and send the user to community resources.Applied to questions. Issues should be closed and send the user to community resources.J-issue-templateApplied to issues not following the template, or missing information.Applied to issues not following the template, or missing information.