0
votes

I am trying to write any new fields in Origin place in Flight search application(https://flights.msn.com/en-in/flight-search) but not able to write. I tried every possible XPath and locators but it is not able to do.

The default value in Origin Place is not removing and it's not allowed to write any new fields.

Link: https://flights.msn.com/en-in/flight-search

Field: Origin Place

enter image description here

Error:

Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//div[@class='js-originplace field-box flex']"} (Session info: chrome=80.0.3987.132)

Code:

<div class="js-originplace field-box flex"><div class="place-selector js-place-selector">
        <div class="place-selector__root clearfix">
            <a href="#" tabindex="1" class="place-selector__cover text-ellipsis js-autocomplete-place-cover populated">Bengaluru <span class="place-selector__cover-id">(Any)<span></span></span></a>
            <div class="place-selector__content">
                <input class="place-selector__input js-place-input" size="1" tabindex="1" type="text" placeholder="Origin city or airport" autocomplete="off" value="">
                <div class="place-selector__loading-spinner js-loading js-spin-activated" style="display: none;">
                <div class="place-selector__dropdown dropdown">
                    <div class="place-selector__not-found js-not-found" style="display: none;">
                        <div data-i18n="search.place.not-found">Type a city or airport</div>
                    </div>
                    <ul class="dropdown-items js-dropdown-items"></ul>
                </div>
            </div>
        </div>
    </div></div>
2

2 Answers

0
votes

Try using element.click on the field and then use clear send keys to send in your input.

0
votes

try this xpath:

//*[@class='js-originplace field-box flex']/descendant-or-self::a

option 2

WebElement element = driver.findElement(By.xpath("//*[@class='js-originplace field-box flex']/descendant-or-self::a"));
JavascriptExecutor js= (JavascriptExecutor)driver;
js.executeScript("arguments[0].click();", element);