Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98788

StopIteration Error During Entering Text to Text Box

$
0
0

I am trying to input a long string (around 4000 characters) into a text box using Python and Selenium.

Once the full string is entered, the whole thing in the text box disappears and below error appears:

Internal StopIteration: False

c:\users\echo\anaconda3\lib\site-packages\ipython\core\interactiveshell.py(3058)run_cell_async() -> interactivity=interactivity, compiler=compiler, result=result)

In debug mode, I tested with send_keys("aapl"), it worked fine, but not with the long string. The loop works fine as well and provides a string including around 800 symbols separated by comma.

My code:

# Get symbols from Excel

filename = "C:/Users/Gui/Cloud/OneDrive/Finance T/Touzi/Investment.xlsx"
wb1 = xl.load_workbook(filename)
ws1 = wb1.worksheets[8]
mr = ws1.max_row
symbols = ""
for i in range(2, mr + 1):
        c = ws1.cell(row = i, column = 1)
        if isinstance(c.value, str):
            symbols += f",{c.value}"
        else:
            print(c)

# Input symbols to Watchlist

WebDriverWait(driver, 30).until(EC.visibility_of_element_located((By.XPATH, '//input[@data-ng-model="userEnteredSymbols"]'))).send_keys(symbols)

# The code for the website:

    <input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" placeholder="Add a symbol..." class="sec-search-box bc-form__add-symbol-input ng-pristine ng-invalid ng-invalid-required ng-touched placeholder" data-ng-model="userEnteredSymbols" data-barchart-clear-input="" required="">```

Viewing all articles
Browse latest Browse all 98788

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>