1

I have tried identifying web elements by writing a page object class and defining all the web elements locators in that class and using them in my test java class but was not able to use them. I am mentioning the code along with the error message down below. 1.>@FindBy(xpath=("‏‏‏‏‏‏‏‎‏‎‎‎‏‏‎‏‎‎‎‏‏‎‎‎‏‏‏‏‎‏‎‎‎‎‏‏‎‏‏//input[@data-autoid='AC_WEBSITE_URL_ctrl']")) @CacheLookup public WebElement WebsiteURLonAccountCreationPage;

The code used in my test class 1.working code line WebElement WebUrl = driver.findElement(By.xpath("//input[@data-autoid='AC_WEBSITE_URL_ctrl']")); WebUrl.sendKeys("abc.com");

  1. not working code line with exception below rm.enterText(acp.WebsiteURLonAccountCreationPage, "abc.com");

[35m[HTTP][39m [37m-->[39m [37mPOST[39m [37m/wd/session/df46e012-a8f2-4544-8e3e-897bc8477ff8/element[39m [35m[HTTP][39m [90m{"using":"xpath","value":"�������‎�‎‎‎��‎�‎‎‎��‎‎‎����‎�‎‎‎‎��‎��//input[@data-autoid='AC_WEBSITE_URL_ctrl']"}[39m [35m[W3C (df46e012)][39m Driver proxy active, passing request on via HTTP proxy [debug] [35m[WD Proxy][39m Proxying [POST /wd/session/df46e012-a8f2-4544-8e3e-897bc8477ff8/element] to [POST http://127.0.0.1:8000/wd/hub/session/64871b861c1b64e4c7613839d5e2b21a/element] with body: {"using":"xpath","value":"�������‎�‎‎‎��‎�‎‎‎��‎‎‎����‎�‎‎‎‎��‎��//input[@data-autoid='AC_WEBSITE_URL_ctrl']"} [35m[WD Proxy][39m Got response with status 400: {"value":{"error":"invalid selector","message":"invalid selector: Unable to locate an element with the xpath expression �������‎�‎‎‎��‎�‎‎‎��‎‎‎����‎�‎‎‎‎��‎��//input[@data-autoid='AC_WEBSITE_URL_ctrl'] because of the following error:\nSyntaxError: Failed to execute 'evaluate' on 'Document': The string '�������‎�‎‎‎��‎�‎‎‎��‎‎‎����‎�‎‎‎‎��‎��//input[@data-autoid='AC_WEBSITE_URL_ctrl']' is not a valid XPath expression.\n (Session info: chrome=83.0.4103.106)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00CC9563+2725219]\n\tOrdinal0 [0x00BC8551+1672529]\n\tOrdinal0 [0x00AB0359+525145]\n\tOrdinal0 [0x00AB20E5+532709]\n\tOrdinal0 [0x00AB1FD4+532436]\n\tOrdinal0 [0x00AB2190+532880]\n\tOrdinal0 [0x00A49551+103761]\n\tOrdinal0 [0x00A653C0+218048]\n\tOrdinal0 [0x00A5AAD0+174800]\n\tOrdinal0 [0x00A63D7C+212348]\n\tOrdinal0 [0x00A5A94B+174411]\n\tOrdinal0 [0x00A42528+75048]\n\tOrdinal0 [0x00A435A0+79264]\n\tOrdinal0 [0x00A43539+79161]\n\tOrdinal0 [0x00BDD607+1758727]\n\tGetHandleVerifier [0x00DE6546+1050150]\n\tGetHandl... [debug] [35m[W3C][39m Matched W3C error code 'invalid selector' to InvalidSelectorError [35m[HTTP][39m [37m<-- POST /wd/session/df46e012-a8f2-4544-8e3e-897bc8477ff8/element [39m[33m400[39m [90m156 ms - 1575[39m [35m[HTTP][39m [90m[39m [35m[HTTP][39m [37m-->[39m [37mPOST[39m [37m/wd/session/df46e012-a8f2-4544-8e3e-897bc8477ff8/element[39m [35m[HTTP][39m [90m{"using":"xpath","value":"�������‎�‎‎‎��‎�‎‎‎��‎‎‎����‎�‎‎‎‎��‎��//input[@data-autoid='AC_WEBSITE_URL_ctrl']"}[39m [35m[W3C (df46e012)][39m Driver proxy active, passing request on via HTTP proxy [debug] [35m[WD Proxy][39m Proxying [POST /wd/session/df46e012-a8f2-4544-8e3e-897bc8477ff8/element] to [POST http://127.0.0.1:8000/wd/hub/session/64871b861c1b64e4c7613839d5e2b21a/element] with body: {"using":"xpath","value":"�������‎�‎‎‎��‎�‎‎‎��‎‎‎����‎�‎‎‎‎��‎��//input[@data-autoid='AC_WEBSITE_URL_ctrl']"} [35m[WD Proxy][39m Got response with status 400: {"value":{"error":"invalid selector","message":"invalid selector: Unable to locate an element with the xpath expression �������‎�‎‎‎��‎�‎‎‎��‎‎‎����‎�‎‎‎‎��‎��//input[@data-autoid='AC_WEBSITE_URL_ctrl'] because of the following error:\nSyntaxError: Failed to execute 'evaluate' on 'Document': The string '�������‎�‎‎‎��‎�‎‎‎��‎‎‎����‎�‎‎‎‎��‎��//input[@data-autoid='AC_WEBSITE_URL_ctrl']' is not a valid XPath expression.\n (Session info: chrome=83.0.4103.106)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00CC9563+2725219]\n\tOrdinal0 [0x00BC8551+1672529]\n\tOrdinal0 [0x00AB0359+525145]\n\tOrdinal0 [0x00AB20E5+532709]\n\tOrdinal0 [0x00AB1FD4+532436]\n\tOrdinal0 [0x00AB2190+532880]\n\tOrdinal0 [0x00A49551+103761]\n\tOrdinal0 [0x00A653C0+218048]\n\tOrdinal0 [0x00A5AAD0+174800]\n\tOrdinal0 [0x00A63D7C+212348]\n\tOrdinal0 [0x00A5A94B+174411]\n\tOrdinal0 [0x00A42528+75048]\n\tOrdinal0 [0x00A435A0+79264]\n\tOrdinal0 [0x00A43539+79161]\n\tOrdinal0 [0x00BDD607+1758727]\n\tGetHandleVerifier [0x00DE6546+1050150]\n\tGetHandl... [debug] [35m[W3C][39m Matched W3C error code 'invalid selector' to InvalidSelectorError [35m[HTTP][39m [37m<-- POST /wd/session/df46e012-a8f2-4544-8e3e-897bc8477ff8/element [39m[33m400[39m [90m55 ms - 1575[39m [35m[HTTP][39m [90m[39m

Any suggestion to solve this would be very helpful.

0 Answers0