How can I validate mer. 1 mai 2019 button?












1















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:
enter image description here










share|improve this question

























  • 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
















1















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:
enter image description here










share|improve this question

























  • 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














1












1








1








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:
enter image description here










share|improve this question
















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:
enter image description here







java eclipse selenium






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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



















  • 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












1 Answer
1






active

oldest

votes


















1
















  1. 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




  2. 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")]




  3. you can find element using this xpath as



    driver.findElement(By.xpath("//calendar-day[@data-day="2019-05-01"]")).click();








share|improve this answer


























  • 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











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
});


}
});














draft saved

draft discarded


















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









1
















  1. 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




  2. 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")]




  3. you can find element using this xpath as



    driver.findElement(By.xpath("//calendar-day[@data-day="2019-05-01"]")).click();








share|improve this answer


























  • 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
















1
















  1. 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




  2. 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")]




  3. you can find element using this xpath as



    driver.findElement(By.xpath("//calendar-day[@data-day="2019-05-01"]")).click();








share|improve this answer


























  • 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














1












1








1









  1. 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




  2. 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")]




  3. you can find element using this xpath as



    driver.findElement(By.xpath("//calendar-day[@data-day="2019-05-01"]")).click();








share|improve this answer

















  1. 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




  2. 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")]




  3. you can find element using this xpath as



    driver.findElement(By.xpath("//calendar-day[@data-day="2019-05-01"]")).click();









share|improve this answer














share|improve this answer



share|improve this answer








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



















  • 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




















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







這個網誌中的熱門文章

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud

Zucchini