Answer the question
In order to leave comments, you need to log in
How to fix Selenium. Message: Element could not be scrolled into view?
Throws an error during list selection. Help me please.
The code:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
driver = webdriver.Firefox()
driver.get("https://kwork.ru/login")
element = driver.find_element_by_id("l_username")
element.send_keys("[email protected]")
element = driver.find_element_by_id("l_password")
element.send_keys("9Thb57G6x")
element = driver.find_element_by_css_selector("#form-login-page > div.w470.dib.v-align-m.foxForm__inner > div.row.form-entry > input.hugeGreenBtn.GreenBtnStyle.h50.pull-left.w240.m-wMax.mr10")
element.send_keys(Keys.ENTER)
cookies = driver.get_cookies()
for cookie in cookies:
driver.add_cookie(cookie)
driver.get("https://kwork.ru/new")
select = Select(driver.find_element_by_xpath('//*[@id="body"]/div[6]/div[9]/form/div[5]/div[1]/div[2]/div[2]/div[1]/div[2]/div[1]/div[1]/select'))
select.select_by_value("83")
element = driver.find_element_by_id("editor-title")
element.send_keys("Напишу статью")
Answer the question
In order to leave comments, you need to log in
Most likely you need to wait until the drop-down list opens.
https://stackoverflow.com/a/51252175
mySelectElement = browser.find_element_by_id('providerTypeDropDown')
dropDownMenu = Select(mySelectElement)
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//select[@id='providerTypeDropDown']//options[contains(.,'Professional')]")))
dropDownMenu.select_by_visible_text('Professional')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question