How can I validate mer. 1 mai 2019 button?
I am using Eclipse(java) with Selenium. Cannot validate button when clicking on May 1st 2019 button (entry).
I have used this:
driver.findElement(By.className("gws-travel-calendar__day-label")).click();
and this:
driver.findElement(By.xpath("//div[contains(@className,'gws-travel-calendar__day-label')][contains(input, '1')]")).click();
This image shows the calendar and the div:
java eclipse selenium
add a comment |
I am using Eclipse(java) with Selenium. Cannot validate button when clicking on May 1st 2019 button (entry).
I have used this:
driver.findElement(By.className("gws-travel-calendar__day-label")).click();
and this:
driver.findElement(By.xpath("//div[contains(@className,'gws-travel-calendar__day-label')][contains(input, '1')]")).click();
This image shows the calendar and the div:
java eclipse selenium
Update the question with the relevant text based HTML of the element
– DebanjanB
Nov 19 '18 at 19:11
You don't see the text on the screenshot?
– Tanguy MP
Nov 19 '18 at 19:21
Don't do this. Please read why a screenshot of HTML or code or error is a bad idea. Consider updating the Question with formatted text based relevant HTML, code trials and error stack trace.
– DebanjanB
Nov 19 '18 at 19:22
add a comment |
I am using Eclipse(java) with Selenium. Cannot validate button when clicking on May 1st 2019 button (entry).
I have used this:
driver.findElement(By.className("gws-travel-calendar__day-label")).click();
and this:
driver.findElement(By.xpath("//div[contains(@className,'gws-travel-calendar__day-label')][contains(input, '1')]")).click();
This image shows the calendar and the div:
java eclipse selenium
I am using Eclipse(java) with Selenium. Cannot validate button when clicking on May 1st 2019 button (entry).
I have used this:
driver.findElement(By.className("gws-travel-calendar__day-label")).click();
and this:
driver.findElement(By.xpath("//div[contains(@className,'gws-travel-calendar__day-label')][contains(input, '1')]")).click();
This image shows the calendar and the div:
java eclipse selenium
java eclipse selenium
edited Nov 19 '18 at 18:58
KevinO
3,10131730
3,10131730
asked Nov 19 '18 at 18:40
Tanguy MPTanguy MP
657
657
Update the question with the relevant text based HTML of the element
– DebanjanB
Nov 19 '18 at 19:11
You don't see the text on the screenshot?
– Tanguy MP
Nov 19 '18 at 19:21
Don't do this. Please read why a screenshot of HTML or code or error is a bad idea. Consider updating the Question with formatted text based relevant HTML, code trials and error stack trace.
– DebanjanB
Nov 19 '18 at 19:22
add a comment |
Update the question with the relevant text based HTML of the element
– DebanjanB
Nov 19 '18 at 19:11
You don't see the text on the screenshot?
– Tanguy MP
Nov 19 '18 at 19:21
Don't do this. Please read why a screenshot of HTML or code or error is a bad idea. Consider updating the Question with formatted text based relevant HTML, code trials and error stack trace.
– DebanjanB
Nov 19 '18 at 19:22
Update the question with the relevant text based HTML of the element
– DebanjanB
Nov 19 '18 at 19:11
Update the question with the relevant text based HTML of the element
– DebanjanB
Nov 19 '18 at 19:11
You don't see the text on the screenshot?
– Tanguy MP
Nov 19 '18 at 19:21
You don't see the text on the screenshot?
– Tanguy MP
Nov 19 '18 at 19:21
Don't do this. Please read why a screenshot of HTML or code or error is a bad idea. Consider updating the Question with formatted text based relevant HTML, code trials and error stack trace.
– DebanjanB
Nov 19 '18 at 19:22
Don't do this. Please read why a screenshot of HTML or code or error is a bad idea. Consider updating the Question with formatted text based relevant HTML, code trials and error stack trace.
– DebanjanB
Nov 19 '18 at 19:22
add a comment |
1 Answer
1
active
oldest
votes
driver.findElement(By.className("gws-travel-calendar__day-label")).click();
this locator is not unique it has 365 matching nodes with that class name so in lay mans term selenium confused where to click
driver.findElement(By.xpath("//div[contains(@className,'gws-travel-calendar__day-label')][contains(input, '1')]")).click();
this xpath you mentioned is not correct, only one attribute of tag can be used at a time like
@class
or@name
, contains method has different syntax than what you have used contains can work in following ways
//div[contains(text(),"text to verify")]
//div[contains(@name,"value of name attribute")]
//div[contains(@class,"value of class attribute")]
you can find element using this xpath as
driver.findElement(By.xpath("//calendar-day[@data-day="2019-05-01"]")).click();
feel free to ask what did not worked for you
– Dev
Nov 19 '18 at 20:32
driver.findElement(By.xpath("//calendar-day[@data-day="2019-05-01"]")).click(); Does not wotk
– Tanguy MP
Nov 19 '18 at 20:40
what error you are getting? have you tried it? why its not working?
– Dev
Nov 19 '18 at 20:42
finally it works. Thanks...
– Tanguy MP
Nov 19 '18 at 21:12
you are most welcome ! happy coding !!
– Dev
Nov 20 '18 at 3:11
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53380799%2fhow-can-i-validate-mer-1-mai-2019-button%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
driver.findElement(By.className("gws-travel-calendar__day-label")).click();
this locator is not unique it has 365 matching nodes with that class name so in lay mans term selenium confused where to click
driver.findElement(By.xpath("//div[contains(@className,'gws-travel-calendar__day-label')][contains(input, '1')]")).click();
this xpath you mentioned is not correct, only one attribute of tag can be used at a time like
@class
or@name
, contains method has different syntax than what you have used contains can work in following ways
//div[contains(text(),"text to verify")]
//div[contains(@name,"value of name attribute")]
//div[contains(@class,"value of class attribute")]
you can find element using this xpath as
driver.findElement(By.xpath("//calendar-day[@data-day="2019-05-01"]")).click();
feel free to ask what did not worked for you
– Dev
Nov 19 '18 at 20:32
driver.findElement(By.xpath("//calendar-day[@data-day="2019-05-01"]")).click(); Does not wotk
– Tanguy MP
Nov 19 '18 at 20:40
what error you are getting? have you tried it? why its not working?
– Dev
Nov 19 '18 at 20:42
finally it works. Thanks...
– Tanguy MP
Nov 19 '18 at 21:12
you are most welcome ! happy coding !!
– Dev
Nov 20 '18 at 3:11
add a comment |
driver.findElement(By.className("gws-travel-calendar__day-label")).click();
this locator is not unique it has 365 matching nodes with that class name so in lay mans term selenium confused where to click
driver.findElement(By.xpath("//div[contains(@className,'gws-travel-calendar__day-label')][contains(input, '1')]")).click();
this xpath you mentioned is not correct, only one attribute of tag can be used at a time like
@class
or@name
, contains method has different syntax than what you have used contains can work in following ways
//div[contains(text(),"text to verify")]
//div[contains(@name,"value of name attribute")]
//div[contains(@class,"value of class attribute")]
you can find element using this xpath as
driver.findElement(By.xpath("//calendar-day[@data-day="2019-05-01"]")).click();
feel free to ask what did not worked for you
– Dev
Nov 19 '18 at 20:32
driver.findElement(By.xpath("//calendar-day[@data-day="2019-05-01"]")).click(); Does not wotk
– Tanguy MP
Nov 19 '18 at 20:40
what error you are getting? have you tried it? why its not working?
– Dev
Nov 19 '18 at 20:42
finally it works. Thanks...
– Tanguy MP
Nov 19 '18 at 21:12
you are most welcome ! happy coding !!
– Dev
Nov 20 '18 at 3:11
add a comment |
driver.findElement(By.className("gws-travel-calendar__day-label")).click();
this locator is not unique it has 365 matching nodes with that class name so in lay mans term selenium confused where to click
driver.findElement(By.xpath("//div[contains(@className,'gws-travel-calendar__day-label')][contains(input, '1')]")).click();
this xpath you mentioned is not correct, only one attribute of tag can be used at a time like
@class
or@name
, contains method has different syntax than what you have used contains can work in following ways
//div[contains(text(),"text to verify")]
//div[contains(@name,"value of name attribute")]
//div[contains(@class,"value of class attribute")]
you can find element using this xpath as
driver.findElement(By.xpath("//calendar-day[@data-day="2019-05-01"]")).click();
driver.findElement(By.className("gws-travel-calendar__day-label")).click();
this locator is not unique it has 365 matching nodes with that class name so in lay mans term selenium confused where to click
driver.findElement(By.xpath("//div[contains(@className,'gws-travel-calendar__day-label')][contains(input, '1')]")).click();
this xpath you mentioned is not correct, only one attribute of tag can be used at a time like
@class
or@name
, contains method has different syntax than what you have used contains can work in following ways
//div[contains(text(),"text to verify")]
//div[contains(@name,"value of name attribute")]
//div[contains(@class,"value of class attribute")]
you can find element using this xpath as
driver.findElement(By.xpath("//calendar-day[@data-day="2019-05-01"]")).click();
edited Nov 19 '18 at 19:38
answered Nov 19 '18 at 19:30
DevDev
649415
649415
feel free to ask what did not worked for you
– Dev
Nov 19 '18 at 20:32
driver.findElement(By.xpath("//calendar-day[@data-day="2019-05-01"]")).click(); Does not wotk
– Tanguy MP
Nov 19 '18 at 20:40
what error you are getting? have you tried it? why its not working?
– Dev
Nov 19 '18 at 20:42
finally it works. Thanks...
– Tanguy MP
Nov 19 '18 at 21:12
you are most welcome ! happy coding !!
– Dev
Nov 20 '18 at 3:11
add a comment |
feel free to ask what did not worked for you
– Dev
Nov 19 '18 at 20:32
driver.findElement(By.xpath("//calendar-day[@data-day="2019-05-01"]")).click(); Does not wotk
– Tanguy MP
Nov 19 '18 at 20:40
what error you are getting? have you tried it? why its not working?
– Dev
Nov 19 '18 at 20:42
finally it works. Thanks...
– Tanguy MP
Nov 19 '18 at 21:12
you are most welcome ! happy coding !!
– Dev
Nov 20 '18 at 3:11
feel free to ask what did not worked for you
– Dev
Nov 19 '18 at 20:32
feel free to ask what did not worked for you
– Dev
Nov 19 '18 at 20:32
driver.findElement(By.xpath("//calendar-day[@data-day="2019-05-01"]")).click(); Does not wotk
– Tanguy MP
Nov 19 '18 at 20:40
driver.findElement(By.xpath("//calendar-day[@data-day="2019-05-01"]")).click(); Does not wotk
– Tanguy MP
Nov 19 '18 at 20:40
what error you are getting? have you tried it? why its not working?
– Dev
Nov 19 '18 at 20:42
what error you are getting? have you tried it? why its not working?
– Dev
Nov 19 '18 at 20:42
finally it works. Thanks...
– Tanguy MP
Nov 19 '18 at 21:12
finally it works. Thanks...
– Tanguy MP
Nov 19 '18 at 21:12
you are most welcome ! happy coding !!
– Dev
Nov 20 '18 at 3:11
you are most welcome ! happy coding !!
– Dev
Nov 20 '18 at 3:11
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53380799%2fhow-can-i-validate-mer-1-mai-2019-button%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Update the question with the relevant text based HTML of the element
– DebanjanB
Nov 19 '18 at 19:11
You don't see the text on the screenshot?
– Tanguy MP
Nov 19 '18 at 19:21
Don't do this. Please read why a screenshot of HTML or code or error is a bad idea. Consider updating the Question with formatted text based relevant HTML, code trials and error stack trace.
– DebanjanB
Nov 19 '18 at 19:22