0

Weird issue I am facing here:

  1. Test fails when Chrome browser is being tested: enter image description here

This is what I get, when chrome is being tested.

  1. When for example FireFox is tested, I do do get this: enter image description here

I did some googling, and there is no frame on a page.. And in general, I am asserting to throw exeption, but it's somehow wrong.?

Would be very thankful for any help as I am so new with selenium, basically one of the first testing attempts :)

update: -Adding html loaded while test is running:

<body>
<div id="react-app">
    <div data-reactroot="" class="container-fluid">
        <div class="row">
            <div class="col-sm-1">
            </div>
            <div class="col-sm-10">
                <div>
                    <div>
                        <h1>Customer</h1>
                        <div>
                            <select id="customer-id">
                                <option value="BAH">BA Holidays</option>
                                <option value="CHEAPCARIB">CheapCaribbean</option>
                                <option value="DELTA">Delta Vacations</option>
                                <option value="1TEST">1 Vacations</option>
                                <option value="LATAM">LATAM</option>
                                <option value="SPIRIT">Spirit Airlines</option>
                                <option value="THOMASCKUK">Thomas Cook UK</option>
                            </select>
                        </div>
                        <div>
                            <h2>Profile</h2>
                            <select id="profile-id">
                                <option value="DL_FH">DL_FH</option>
                                <option value="DL_FHM">DL_FHM</option>
                            </select>
                        </div>
                        <div>
                            <button id="download-order-template" class="ui-button ui-widget ui-state-default ui-corner-all">
                            <span class="ui-button-text ui-c">
                            Download Template
                            </span>
                            </button>
                        </div>
                        <div>
                            <h2>Place a new standalone order</h2>
                            <span class="ui-button ui-fileupload-choose ui-widget ui-state-default ui-corner-all ui-button-text-icon-left">
                            <span class="ui-button-icon-left fa fa-plus">
                            </span>
                            <span class="ui-button-text ui-clickable">
                            Select File To Upload
                            </span>
                            <input type="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
                            </span>
                        </div>
                        <div>
                            <h2>Replace all Subscriptions</h2>
                            <span class="ui-button ui-fileupload-choose ui-widget ui-state-default ui-corner-all ui-button-text-icon-left">
                            <span class="ui-button-icon-left fa fa-plus">
                            </span>
                            <span class="ui-button-text ui-clickable">
                            Select File To Upload
                            </span>
                            <input type="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
                            </span>
                        </div>
                        <h2>Subscription Lines</h2>
                        <div>
                            <h3 id="no-subscriptions-message">
                                No subscriptions are available for selected profile
                            </h3>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-1">
            </div>
        </div>
    </div>
</div>
<script src="/dist/vendor.js?v=FSqTLWksDyRJ8ISowkFa5SF8Km7z2u2VqPZf0m3lpXA"></script>
<script src="/dist/main.js?v=zuIW3HpayKUQgmfsu0Hi17_VJILvxurljy9Fv0yHLMA"></script>
</body>
Geert Bellekens
  • 12,788
  • 2
  • 23
  • 50
DevyDev
  • 846
  • 3
  • 14
  • 37
  • So _fails_ on both cases. Check this discussion [NoSuchElementExeption, selenium unable to locate element](https://stackoverflow.com/questions/48471321/nosuchelementexeption-selenium-unable-to-locate-element/48472940#48472940) – undetected Selenium May 18 '18 at 09:14
  • What seems to be the problem here? – Aman B May 18 '18 at 09:16
  • In both cases, you are getting Nosuch element, it means your ID which you have taken it's not correct? Share the html – Ankit Gupta May 18 '18 at 09:37
  • Added html, And about asserting test, I am expecting it to throw exception, but if compared screen shot 1 to screen shot 2, exceptions is different.. – DevyDev May 18 '18 at 09:46
  • I can't see anything with id = download-subscription-lines inside your HTML ? – Prany May 18 '18 at 09:59
  • That's correct.. If you check any of screen shots, I am expecting it to throw exception. At this moment test fails and returns: ----> NUnit.Framework.AssertionException : Expected: But was: null – DevyDev May 18 '18 at 10:10
  • Please read why a [screenshot of HTML or code or error is a bad idea](https://meta.stackoverflow.com/questions/303812/discourage-screenshots-of-code-and-or-errors). Consider updating the Question with formatted text based relevant HTML, code trials and error stack trace. – undetected Selenium May 18 '18 at 11:25
  • As a quick, Friday evening work around I've changed to regex check, if elements exists.. Will come back to this later today/tomorrow and will updated snippets here – DevyDev May 18 '18 at 12:37

1 Answers1

0

Exceptions are not different because they follow the same guidelines from the Selenium Framework but each WebDriver can choose to add additional debug informations to help fix issues in their underlying engines (which is specific to each browser of course).

ChromeDriver tends to be more "chatty" about errors, just ignore these if you only care about the result of your test suite.

rak007
  • 973
  • 12
  • 26
  • Thank you for reply. ! I had same idea of this, but what I cannot understand, if I am excepting for this exception to be thrown, but test still gets marked as failed. I can see this line after test failure: Message: System.InvalidOperationException : WebDriver: OpenQA.Selenium.Firefox.FirefoxDriver ----> NUnit.Framework.AssertionException : Expected: But was: null – DevyDev May 18 '18 at 10:27
  • So you are trying to catch `NoSuchElementException` but NUnit is not catching it properly depending on WebDriver right ? Your question leads to wrong assumption – rak007 May 18 '18 at 10:36
  • I do not want to be misleading, but in general, I want this test to throw an exception.. This test simply loads a page where it won't find these 2 elements, and thats how it should be, so I just want test to verify, that these 2 elements is not visible. In test I am trying to select elements by id, and get an exception, which would verify these 2 elements not being visible at that time. – DevyDev May 18 '18 at 10:40