Replies: 2 comments
-
@Maha2201 it seems you are not using |
Beta Was this translation helpful? Give feedback.
0 replies
-
thanks you, and it worked! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi
I am a newbie to webdriver IO, I am trying a sample scenario to open the website "https://www.javatpoint.com/" and click on HTML and navigate to HTML link and verify the URL now is "https://www.javatpoint.com/html-tutorial"
home.page.js
class HomePage {
get htmlLink() {
return $('a[href="html-tutorial"]');
// link.click();
}
}
export default new HomePage();
Step definition file:
import HomePage from '../pageobjects/home.page.js';
Given(/^I am on the JavaTPoint website$/, () => {
browser.url('https://www.javatpoint.com/');
});
When(/^I click on the HTML link$/, () => {
HomePage.htmlLink.click();
});
Then(/^I should be redirected to the HTML page$/, () => {
const htmlUrl = 'https://www.javatpoint.com/html-tutorial';
expect(browser).toHaveUrl(htmlUrl);
});
Below is the error I am getting
[0-0] 2024-02-23T16:58:21.281Z INFO webdriver: RESULT {
[0-0] 'element-6066-11e4-a52e-4f735466cecf': 'B708DB55373AC860EB7812B28B655566_element_55'
[0-0] }
[0-0] 2024-02-23T16:58:21.298Z INFO webdriver: COMMAND elementClick("B708DB55373AC860EB7812B28B655566_element_55")
[0-0] 2024-02-23T16:58:21.298Z INFO webdriver: [POST] http://0.0.0.0:51295/session/ff61893b3770ab17afe368cfdf672652/element/B708DB55373AC860EB7812B28B655566_element_55/click
[0-0] 2024-02-23T16:58:21.311Z INFO webdriver: RESULT https://www.javatpoint.com/
[0-0] file:///C:/Users/MS00813019/Mahalakshmi/BT-POc/23FebEdge2PM%20-%20Bkup/features/step-definitions/steps.js:17
[0-0] expect(browser).toHaveUrl(htmlUrl);
[0-0] ^
[0-0]
[0-0] JestAssertionError: Expect window to have url
[0-0]
[0-0] Expected: "https://www.javatpoint.com/html-tutorial"
[0-0] Received: "https://www.javatpoint.com/"
I assume it able to locate an element and try to click on it, can someone help to throw some light on whats happening.
Beta Was this translation helpful? Give feedback.
All reactions