Strange XPath behavior Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceSelenium IDE problems with a new:from XPathVerify xpath is valid with developer tools in IE8XPath given by Chrome DevTools could not be foundSelenium - Searching Element by xPath is not found during execution but it is found on BrowserWebpage view source has body content as 'please wait' and selenium is unable to load any elementsInspect element without right clicking in ChromeUnable to click login dropdown via xpathPython Selenium find element XPath doesn't workUnable to locate element error through Selenium after copying xPath locationXpath is invalid in Selenium's automated browser

Why don't the Weasley twins use magic outside of school if the Trace can only find the location of spells cast?

Limit for e and 1/e

If A makes B more likely then B makes A more likely"

Mortgage adviser recommends a longer term than necessary combined with overpayments

How are presidential pardons supposed to be used?

Is there folklore associating late breastfeeding with low intelligence and/or gullibility?

What are the performance impacts of 'functional' Rust?

What items from the Roman-age tech-level could be used to deter all creatures from entering a small area?

Is there a documented rationale why the House Ways and Means chairman can demand tax info?

Determine whether f is a function, an injection, a surjection

Can a non-EU citizen traveling with me come with me through the EU passport line?

Complexity of many constant time steps with occasional logarithmic steps

Notation for two qubit composite product state

Why use gamma over alpha radiation?

Cauchy Sequence Characterized only By Directly Neighbouring Sequence Members

Passing functions in C++

How does modal jazz use chord progressions?

Why does tar appear to skip file contents when output file is /dev/null?

Autumning in love

Estimate capacitor parameters

Simulating Exploding Dice

Using "nakedly" instead of "with nothing on"

Did the new image of black hole confirm the general theory of relativity?

Is above average number of years spent on PhD considered a red flag in future academia or industry positions?



Strange XPath behavior



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experienceSelenium IDE problems with a new:from XPathVerify xpath is valid with developer tools in IE8XPath given by Chrome DevTools could not be foundSelenium - Searching Element by xPath is not found during execution but it is found on BrowserWebpage view source has body content as 'please wait' and selenium is unable to load any elementsInspect element without right clicking in ChromeUnable to click login dropdown via xpathPython Selenium find element XPath doesn't workUnable to locate element error through Selenium after copying xPath locationXpath is invalid in Selenium's automated browser



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















Admittedly, I don't have much experience in selenium or advanced website building but this has had me stumped for a few days now



After trying to get selenium to find this one element 20 different ways, I ended up just using chromes console to try and find it through there with the $x() command. That's where I really got confused though, I have no idea why it's not finding it one second, then magically finding it the next



here's what the console output looks like:



weird xpath behavior



Strangely enough, even when I click on the element and retry the above xpath command, it still can't find it. The only way that i can get it to find the element is if I use chromes ctrl + shift + c command to click on the element and see it in element tab. I can't right click and inspect the element because it brings up it's own menu, it only works through that shortcut or clicking the button that activates that command.



I have a feeling this is why my Selenium script can't find the element and I'm not sure how to fix it or even why it's happening. Any input that could help wrap my head around this would be appreciated greatly, thank you!










share|improve this question






















  • can you please share your html?

    – KunduK
    Mar 8 at 13:54











  • You may be onto something...if i inspect element and copy part of that code and view the page source I can't find it in there. Maybe it has something to do with an iFrame? Does selenium work with iFrames do you know?

    – NickM
    Mar 8 at 14:10











  • Yes.You need to switch to iframe first to access the elemet.

    – KunduK
    Mar 8 at 14:21











  • I cannot believe I didn't think of this before, thank you so much Kajal - really appreciate the help

    – NickM
    Mar 8 at 14:30

















1















Admittedly, I don't have much experience in selenium or advanced website building but this has had me stumped for a few days now



After trying to get selenium to find this one element 20 different ways, I ended up just using chromes console to try and find it through there with the $x() command. That's where I really got confused though, I have no idea why it's not finding it one second, then magically finding it the next



here's what the console output looks like:



weird xpath behavior



Strangely enough, even when I click on the element and retry the above xpath command, it still can't find it. The only way that i can get it to find the element is if I use chromes ctrl + shift + c command to click on the element and see it in element tab. I can't right click and inspect the element because it brings up it's own menu, it only works through that shortcut or clicking the button that activates that command.



I have a feeling this is why my Selenium script can't find the element and I'm not sure how to fix it or even why it's happening. Any input that could help wrap my head around this would be appreciated greatly, thank you!










share|improve this question






















  • can you please share your html?

    – KunduK
    Mar 8 at 13:54











  • You may be onto something...if i inspect element and copy part of that code and view the page source I can't find it in there. Maybe it has something to do with an iFrame? Does selenium work with iFrames do you know?

    – NickM
    Mar 8 at 14:10











  • Yes.You need to switch to iframe first to access the elemet.

    – KunduK
    Mar 8 at 14:21











  • I cannot believe I didn't think of this before, thank you so much Kajal - really appreciate the help

    – NickM
    Mar 8 at 14:30













1












1








1








Admittedly, I don't have much experience in selenium or advanced website building but this has had me stumped for a few days now



After trying to get selenium to find this one element 20 different ways, I ended up just using chromes console to try and find it through there with the $x() command. That's where I really got confused though, I have no idea why it's not finding it one second, then magically finding it the next



here's what the console output looks like:



weird xpath behavior



Strangely enough, even when I click on the element and retry the above xpath command, it still can't find it. The only way that i can get it to find the element is if I use chromes ctrl + shift + c command to click on the element and see it in element tab. I can't right click and inspect the element because it brings up it's own menu, it only works through that shortcut or clicking the button that activates that command.



I have a feeling this is why my Selenium script can't find the element and I'm not sure how to fix it or even why it's happening. Any input that could help wrap my head around this would be appreciated greatly, thank you!










share|improve this question














Admittedly, I don't have much experience in selenium or advanced website building but this has had me stumped for a few days now



After trying to get selenium to find this one element 20 different ways, I ended up just using chromes console to try and find it through there with the $x() command. That's where I really got confused though, I have no idea why it's not finding it one second, then magically finding it the next



here's what the console output looks like:



weird xpath behavior



Strangely enough, even when I click on the element and retry the above xpath command, it still can't find it. The only way that i can get it to find the element is if I use chromes ctrl + shift + c command to click on the element and see it in element tab. I can't right click and inspect the element because it brings up it's own menu, it only works through that shortcut or clicking the button that activates that command.



I have a feeling this is why my Selenium script can't find the element and I'm not sure how to fix it or even why it's happening. Any input that could help wrap my head around this would be appreciated greatly, thank you!







javascript python html css selenium






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 13:48









NickMNickM

263




263












  • can you please share your html?

    – KunduK
    Mar 8 at 13:54











  • You may be onto something...if i inspect element and copy part of that code and view the page source I can't find it in there. Maybe it has something to do with an iFrame? Does selenium work with iFrames do you know?

    – NickM
    Mar 8 at 14:10











  • Yes.You need to switch to iframe first to access the elemet.

    – KunduK
    Mar 8 at 14:21











  • I cannot believe I didn't think of this before, thank you so much Kajal - really appreciate the help

    – NickM
    Mar 8 at 14:30

















  • can you please share your html?

    – KunduK
    Mar 8 at 13:54











  • You may be onto something...if i inspect element and copy part of that code and view the page source I can't find it in there. Maybe it has something to do with an iFrame? Does selenium work with iFrames do you know?

    – NickM
    Mar 8 at 14:10











  • Yes.You need to switch to iframe first to access the elemet.

    – KunduK
    Mar 8 at 14:21











  • I cannot believe I didn't think of this before, thank you so much Kajal - really appreciate the help

    – NickM
    Mar 8 at 14:30
















can you please share your html?

– KunduK
Mar 8 at 13:54





can you please share your html?

– KunduK
Mar 8 at 13:54













You may be onto something...if i inspect element and copy part of that code and view the page source I can't find it in there. Maybe it has something to do with an iFrame? Does selenium work with iFrames do you know?

– NickM
Mar 8 at 14:10





You may be onto something...if i inspect element and copy part of that code and view the page source I can't find it in there. Maybe it has something to do with an iFrame? Does selenium work with iFrames do you know?

– NickM
Mar 8 at 14:10













Yes.You need to switch to iframe first to access the elemet.

– KunduK
Mar 8 at 14:21





Yes.You need to switch to iframe first to access the elemet.

– KunduK
Mar 8 at 14:21













I cannot believe I didn't think of this before, thank you so much Kajal - really appreciate the help

– NickM
Mar 8 at 14:30





I cannot believe I didn't think of this before, thank you so much Kajal - really appreciate the help

– NickM
Mar 8 at 14:30












1 Answer
1






active

oldest

votes


















1














The element I wanted to click on was hidden under THREE iFrames which is why it couldn't find it. After switching through them, the script functioned correctly - Thank you to Kajal Kundu for his simple question of asking for the HTML, I don't know why I didn't think of iframes possibly messing it up until I started copying the code for him :)






share|improve this answer























    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%2f55064568%2fstrange-xpath-behavior%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














    The element I wanted to click on was hidden under THREE iFrames which is why it couldn't find it. After switching through them, the script functioned correctly - Thank you to Kajal Kundu for his simple question of asking for the HTML, I don't know why I didn't think of iframes possibly messing it up until I started copying the code for him :)






    share|improve this answer



























      1














      The element I wanted to click on was hidden under THREE iFrames which is why it couldn't find it. After switching through them, the script functioned correctly - Thank you to Kajal Kundu for his simple question of asking for the HTML, I don't know why I didn't think of iframes possibly messing it up until I started copying the code for him :)






      share|improve this answer

























        1












        1








        1







        The element I wanted to click on was hidden under THREE iFrames which is why it couldn't find it. After switching through them, the script functioned correctly - Thank you to Kajal Kundu for his simple question of asking for the HTML, I don't know why I didn't think of iframes possibly messing it up until I started copying the code for him :)






        share|improve this answer













        The element I wanted to click on was hidden under THREE iFrames which is why it couldn't find it. After switching through them, the script functioned correctly - Thank you to Kajal Kundu for his simple question of asking for the HTML, I don't know why I didn't think of iframes possibly messing it up until I started copying the code for him :)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 8 at 14:56









        NickMNickM

        263




        263





























            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%2f55064568%2fstrange-xpath-behavior%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







            Popular posts from this blog

            1928 у кіно

            Захаров Федір Захарович

            Ель Греко