0
votes

I am developing a bot to upload the video automatically on the Website using selenium python. During development, there is a Combobox that must be selected to proceed further. I used the select function to select this combo box option. but combo doesn't accept this and shows div wont accept select function. HTML code of combo box: I couldn't find the options also in the HTML code.

<div class="ant-select-selection
        ant-select-selection--single" role="combobox" aria-autocomplete="list" aria-haspopup="true" aria-controls="96c82e35-7e56-473d-a6ee-9ff4e1352d77" aria-expanded="false" tabindex="0">
<div class="ant-select-selection__rendered">
    <div unselectable="on" class="ant-select-selection__placeholder" style="display: block; user-select: none;">Genre</div>
    <div class="ant-select-search ant-select-search--inline" style="display: none;">
        <div class="ant-select-search__field__wrap">
            <input autocomplete="off" class="ant-select-search__field" value="">
                <span class="ant-select-search__field__mirror">&nbsp;</span>
            </div>
        </div>
    </div>
    <span class="ant-select-arrow" unselectable="on" style="user-select: none;">
        <i aria-label="icon: down" class="anticon anticon-down ant-select-arrow-icon">
            <svg viewBox="64 64 896 896" focusable="false" class="" data-icon="down" width="1em" height="1em" fill="currentColor" aria-hidden="true">
                <path d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"></path>
            </svg>
        </i>
    </span>
</div>

Is there any way to select the options in the above code?

1

1 Answers

0
votes

you can use selct method only with select tag , with other tags you should follow normal click and wait

driver.find_element_by_xpath('//div[@class="ant-select-selection ant-select-selection--single" and @role="combobox"]//input').click()

driver.find_element_by_xpath('//div[@class="ant-select-selection ant-select-selection--single" and @role="combobox"]//input').send_keys("something")


WebDriverWait(driver,10).until(EC.presence_of_element_located((By.XPATH, "//*[contains(text(),'something')]"))).click()