【问题标题】:selenium select option click error硒选择选项点击错误
【发布时间】:2016-11-09 08:37:42
【问题描述】:

爬虫的HTML代码

<select size="10" name="ctl00$ContentPlaceHolder1$lstMake" onchange="javascript:setTimeout('__doPostBack(\'ctl00$ContentPlaceHolder1$lstMake\',\'\')', 0)" id="ctl00_ContentPlaceHolder1_lstMake">
    <option value="913163">Abarth</option>
    <option value="913229">Acura (USA / CAN)</option>
    <option value="910001">Alfa Romeo</option>
    <option value="910066">Aro</option>
    <option value="910071">Asia</option>
    <option value="910002">Aston Martin</option>
    <option value="910052">Audi</option>
    <option value="910003">Austin</option>
    <option value="910004">Bentley</option>
    <option value="910005">BMW (EU)</option>
    <option value="913536">BMW (USA)</option>
    <option value="910072">Brabus</option>
...

</select>

Python 代码

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

driver = webdriver.Chrome()
driver.get("https://motul.lubricantadvisor.com/Default.aspx?data=1&amp;lang=ENG&lang=eng")
wait = WebDriverWait(driver, 10)

# Select Car
driver.find_element_by_id("ctl00_ContentPlaceHolder1_rptCategoryBtn_ctl01_btnImage").click();

# Select Company (BMW Click)
wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, "#ctl00_ContentPlaceHolder1_lstMake > option")))
company_option = Select(driver.find_element_by_id("ctl00_ContentPlaceHolder1_lstMake"))
company_option.select_by_index(2)

错误日志

Traceback (most recent call last):
  File "/Users/MyeongSic/PycharmProjects/crawler/SeriesCounter.py", line 17, in <module>
company_option.select_by_index(2)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/support/select.py", line 101, in select_by_index
self._setSelected(opt)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/support/select.py", line 212, in _setSelected
option.click()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/remote/webelement.py", line 77, in click
self._execute(Command.CLICK_ELEMENT)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/remote/webelement.py", line 494, in _execute
return self._parent.execute(command, params)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
self.error_handler.check_response(response)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotVisibleException: Message: element not visible: Element is not currently visible and may not be manipulated
  (Session info: chrome=54.0.2840.87)
  (Driver info: chromedriver=2.25.426935     (820a95b0b81d33e42712f9198c215f703412e1a1),platform=Mac OS X 10.12.1 x86_64)

我试过了。发生错误为什么要这样做?我不明白。我尝试了另一个选择选项示例。它没有错误,但这没有执行。你能告诉我这个错误吗?

添加评论(详细图片)

我需要让craling'选择类型'的位置自动

【问题讨论】:

    标签: python html selenium web-crawler


    【解决方案1】:

    使用下面的代码:

    from selenium import webdriver
    from selenium.webdriver.support.select import Select
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.support import expected_conditions as EC
    from selenium.webdriver.common.by import By
    
    
    driver = webdriver.Chrome()
    driver.maximize_window()
    driver.get("https://motul.lubricantadvisor.com/Default.aspx?data=1&amp;lang=ENG&lang=eng")
    wait = WebDriverWait(driver, 10)
    wait.until(EC.presence_of_element_located((By.ID, "ctl00_ContentPlaceHolder1_rptCategoryBtn_ctl01_btnImage")))
    
    driver.find_element(By.ID,"ctl00_ContentPlaceHolder1_rptCategoryBtn_ctl01_btnImage").click()
    
    wait.until(EC.presence_of_element_located((By.ID, "ctl00_ContentPlaceHolder1_lblSelectedMake")))
    driver.find_element(By.ID,'ctl00_ContentPlaceHolder1_lblSelectedMake').click()
    
    wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, "#ctl00_ContentPlaceHolder1_lstMake")))
    
    drop=driver.find_element(By.NAME,'ctl00$ContentPlaceHolder1$lstMake')
    sel = Select(drop)
    sel.select_by_visible_text('BMW (EU)')
    

    在您的代码中,您试图在元素在 DOM 上可用之前单击

    更新 2:基于新要求删除旧代码:

    from selenium import webdriver
    from selenium.webdriver.support.select import Select
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.support import expected_conditions as EC
    from selenium.webdriver.common.by import By
    import time
    from selenium.webdriver.common.action_chains import ActionChains
    
    
    driver = webdriver.Chrome()
    driver.maximize_window()
    driver.get("https://motul.lubricantadvisor.com/Default.aspx?data=1&amp;lang=ENG&lang=eng")
    
    def getallcars():
        wait = WebDriverWait(driver, 10)
        wait.until(EC.presence_of_element_located((By.ID, "ctl00_ContentPlaceHolder1_rptCategoryBtn_ctl01_btnImage")))
    
        driver.find_element(By.ID, "ctl00_ContentPlaceHolder1_rptCategoryBtn_ctl01_btnImage").click()
    
        wait.until(EC.presence_of_element_located((By.ID, "ctl00_ContentPlaceHolder1_lblSelectedMake")))
        driver.find_element(By.ID, 'ctl00_ContentPlaceHolder1_lblSelectedMake').click()
    
        wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, "#ctl00_ContentPlaceHolder1_lstMake")))
    
        el = driver.find_element(By.NAME,"ctl00$ContentPlaceHolder1$lstMake")
        car =[]
        for option in el.find_elements(By.TAG_NAME,'option'):
            car.append((option.text).encode('utf8'))
        return car
    
    cars=getallcars()
    
    
    for value in cars:
        drop = driver.find_element(By.CSS_SELECTOR, '#ctl00_ContentPlaceHolder1_lstMake')
        sel = Select(drop)
        sel.select_by_visible_text(value)
        time.sleep(2)
        driver.find_element(By.ID,'ctl00_ContentPlaceHolder1_HeaderModel').click()
        el2 = driver.find_element(By.NAME, "ctl00$ContentPlaceHolder1$lstModel")
        print "The models for %s are:"  %value
        for option in el2.find_elements(By.TAG_NAME,'option'):
            print  option.text
        action = ActionChains(driver)
        action.move_to_element_with_offset(el2, 300, 200)
        action.click()
        action.perform()
        driver.find_element(By.CSS_SELECTOR,'#ctl00_ContentPlaceHolder1_HeaderMake').click()
    

    此代码首先从下拉列表中获取所有值,然后依次选择并打印该汽车的模型

    这是几辆车的示例输出:

    The models for Abarth are:
    500, 150 (2008 - )
    Grande Punto, 199 (2007 - 2009)
    Punto EVO, 199 (2010 - 2012)
    Punto, 199 (2012 - 2014)
    The models for Acura (USA / CAN) are:
    CSX (2006 - 2011)
    EL (2001 - 2005)
    ILX (2012 - )
    Integra (1996 - 2001)
    MDX, YD1 (2001 - 2006)
    MDX, YD2 (2007 - 2013)
    MDX, YD3 (2013 - )
    RDX, TB1 (2007 - 2012)
    RDX, TB2 (2012 - )
    RL, KA9, KB1, KB2 (2001 - 2012)
    RLX (2013 - )
    RSX, DC5 (2002 - 2006)
    SLX, DJ5 (1996 - 1999)
    TL, UA4, UA5 (2001 - 2003)
    TL, UA6, UA7 (2004 - 2008)
    TL, UA8, UA9 (2009 - 2014)
    TSX, CL9 (2004 - 2008)
    TSX, CU2 (2009 - 2014)
    TLX (2014 - )
    ZDX (2010 - 2013)
    The models for Alfa Romeo are:
    MiTo, 955 (2008 - )
    33 (1983 - 1994)
    145 (1994 - 2000)
    146 (1994 - 2001)
    147, 937 (2000 - 2010)
    Giulietta, 940 (2010 - )
    75 (1985 - 1992)
    155 (1992 - 1997)
    156 (1997 - 2007)
    159, 939 (2005 - 2011)
    90 (1984 - 1988)
    164 (1987 - 1998)
    166 (1998 - 2007)
    GT (2004 - 2011)
    GTV (1995 - 2005)
    Brera (2006 - 2011)
    Spider (1983 - 1993)
    Spider (1995 - 2005)
    Spider (2006 - 2011)
    SZ, RZ (1989 - 1994)
    4C (2013 - )
    8C (2007 - 2010)
    The models for Aro are:
    10 (Duster) (1984 - 2006)
    24 (1980 - 2006)
    The models for Asia are:
    Rocsta (1993 - 1999)
    The models for Aston Martin are:
    Cygnet (2011 - 2013)
    V8 (1982 - 2001)
    V8 Vantage (2005 - )
    V12 Vantage (2010 - )
    DB7 (1994 - 2004)
    DB9 (2003 - )
    Virage (2011 - 2012)
    V12 Vanquish (2001 - 2007)
    DBS (2008 - 2012)
    Vanquish (2012 - )
    Rapide (2010 - )
    One-77 (2011 - 2012)
    The models for Audi are:
    A1, S1, 8X (2010 - )
    A2, 8Z (2000 - 2005)
    A3, S3 (1996 - 2003)
    A3, S3, RS3, 8P (2003 - 2013)
    A3 Cabriolet, 8P7 (2008 - 2013)
    A3, S3, 8V (2012 - )
    A3, S3 Cabriolet, 8V7 (2013 - )
    80, RS2 (1986 - 1995)
    90 (1985 - 1992)
    Cabriolet (1991 - 2000)
    Coupé, S2 (1986 - 1995)
    A4, S4, RS4, 8D (1994 - 2001)
    A4, S4, RS4, 8E (2001 - 2008)
    A4, S4, RS4, 8K (2007 - )
    A4 Allroad, 8KH (2009 - )
    A5, S5, RS5, 8T (2007 - )
    A5, S5, RS5 Cabriolet, 8F7 (2009 - )
    100, S4 (1986 - 1994)
    200 (1986 - 1989)
    A6, S6, 4A (1994 - 1997)
    A6, S6, RS6, 4B (1997 - 2005)
    A6 Allroad, 4B (2000 - 2005)
    A6, S6, RS6, 4F (2005 - 2011)
    A6 Allroad, 4F (2006 - 2011)
    A6, S6, RS6, 4G (2010 - )
    A6 Allroad, 4G (2012 - )
    A7, S7, RS7, 4G (2010 - )
    V8 (1989 - 1994)
    A8, S8, 4D (1994 - 2003)
    A8, S8, 4E (2003 - 2010)
    A8, S8, 4H (2010 - )
    Q3, RS Q3, 8U (2011 - )
    Q5, SQ5, 8R (2008 - )
    Q7, 4L (2006 - 2015)
    Q7, 4M (2015 - )
    TT, 8N (1998 - 2006)
    TT, TTS, TT RS, 8J3 (2006 - 2014)
    TT, TTS, TT RS Roadster, 8J9 (2007 - 2014)
    TT, TTS, FV3 (2014 - )
    TT, TTS Roadster, FV9 (2014 - )
    Quattro (1980 - 1987)
    R8 Coupé, 423 (2007 - 2015)
    R8 Spyder, 429 (2010 - 2015)
    The models for Austin are:
    MINI (1980 - 1991)
    Metro (1983 - 1990)
    Maestro (1984 - 1990)
    Montego (1984 - 1990)
    Ambassador (1983 - 1984)
    The models for Bentley are:
    Eight, Mulsanne (1986 - 1992)
    Brooklands (1992 - 1999)
    Turbo (1986 - 1999)
    Continental, Azure (1986 - 2003)
    Arnage (1998 - 2006)
    Continental Flying Spur, B72 (2005 - )
    Continental GT, B71 (2003 - )
    The models for BMW (EU) are:
    1-Series, E81 / E82 / E87 (2004 - 2013)
    1-Series Convertible, E88 (2007 - 2013)
    1-Series, F20 / F21 (2011 - )
    2-Series, F22 (2013 - )
    2-Series Convertible, F23 (2015 - )
    2-Series Active Tourer, F45 (2014 - )
    2-Series Gran Tourer, F46 (2015 - )
    3-Series, E30 (1986 - 1992)
    3-Series, E36 (1990 - 2001)
    3-Series, E46 (1998 - 2006)
    3-Series, E90 / E91 / E92 (2004 - 2013)
    3-Series Convertible, E93 (2007 - 2013)
    3-Series, F30 / F31 / F80 (2012 - )
    3-Series Gran Turismo, F34 (2013 - )
    4-Series, F32 / F82 (2013 - )
    4-Series Convertible, F33 / F83 (2014 - )
    4-Series Gran Coupé, F36 (2014 - )
    5-Series, E34 (1988 - 1995)
    5-Series, E39 (1995 - 2004)
    5-Series, E60 / E61 (2003 - 2011)
    5-Series Gran Turismo, F07 (2009 - )
    5-Series, F10 / F11 (2010 - )
    6-Series, E63 / E64 (2004 - 2011)
    6-Series Coupé, F13 (2010 - )
    6-Series Convertible, F12 (2011 - )
    6-Series Gran Coupé, F06 (2012 - )
    7-Series, E32 (1987 - 1994)
    7-Series, E38 (1994 - 2001)
    7-Series, E65 / E66 (2001 - 2008)
    7-Series, F01 / F02 / F03 / F04 (2008 - 2015)
    7-Series, G11 / G12 (2015 - )
    8-Series, E31 (1990 - 1999)
    i3, I01 (2013 - )
    i8, I12 (2014 - )
    X1, E84 (2009 - 2015)
    X1, F48 (2015 - )
    X3, E83 (2004 - 2010)
    X3, F25 (2010 - )
    X4, F26 (2014 - )
    X5, E53 (1999 - 2007)
    X5, E70 (2007 - 2013)
    X5, F15 / F85 (2013 - )
    X6, E71 / E72 (2008 - 2014)
    X6, F16 / F86 (2014 - )
    Z1, Z1 (1988 - 1992)
    Z3, E36 (1995 - 2003)
    Z4 Roadster, E85 (2002 - 2008)
    Z4 Coupé, E86 (2006 - 2008)
    Z4 Roadster, E89 (2008 - )
    Z8, E52 (2000 - 2003)
    The models for BMW (USA) are:
    1-Series, E82 (2007 - 2013)
    1-Series Convertible, E88 (2007 - 2013)
    2-Series, F22 (2014 - )
    2-Series Convertible, F23 (2014 - )
    3-Series, E90 / E91 / E92 (2004 - 2013)
    3-Series Convertible, E93 (2007 - 2013)
    3-Series, F30 / F31 / F80 (2012 - )
    3-Series Gran Turismo, F34 (2013 - )
    4-Series, F32 / F82 (2013 - )
    4-Series Convertible, F33 / F83 (2014 - )
    4-Series Gran Coupé, F36 (2014 - )
    5-Series, E60 / E61 (2003 - 2011)
    The models for Brabus are:
    smart (1998 - 2002)
    A (1999 - 2004)
    C (1991 - 2002)
    E (1993 - 2002)
    SLK/CLK (1997 - 2002)
    S/SL/CL (1993 - 2005)
    M (1993 - 2000)
    V (1999 - 2002)
    The models for Bugatti are:
    Veyron (2005 - )
    The models for Buick are:
    Verano (2012 - )
    Encore (2012 - )
    Century (1996 - 2005)
    Regal (1997 - )
    LaCrosse, Allure (2004 - )
    LeSabre (1999 - 2005)
    Park Avenue (1991 - 2005)
    Lucerne (2005 - 2011)
    Terraza (2004 - 2007)
    Rendezvous (2001 - 2007)
    Rainier (2004 - 2007)
    Enclave (2008 - )
    The models for Cadillac (EU) are:
    ATS (2013 - )
    CTS(-V) (2013 - )
    SRX (2012 - )
    Escalade (2013 - )
    The models for Cadillac (USA) are:
    BLS (2006 - 2009)
    ATS (2012 - )
    CTS(-V) (2003 - )
    XTS (2012 - )
    Seville (1997 - 2004)
    STS(-V) (2004 - 2011)
    DeVille (1999 - 2005)
    DTS (2006 - 2011)
    XLR (2004 - 2009)
    SRX (2004 - )
    Escalade (2001 - )
    ELR (2013 - )
    The models for Chery are:
    QQ6 (2006 - )
    Chance / Niche (2008 - )
    M11 / M12 (2008 - )
    Tengo (2008 - )
    A1 / J1 / Kimo (2007 - )
    IndiS / X1 (2011 - )
    A3 / E3 / Bonus (2008 - )
    A5 / Fora / Elara (2006 - )
    E5 (2012 - )
    Arrizo (2013 - )
    Riich (2009 - 2012)
    J11 / Tiggo (2006 - )
    Tiggo 5 (2014 - )
    Boss (2006 - )
    CrossEastar (2006 - )
    The models for Chevrolet (EU) (Daewoo) are:
    Tico (1991 - 1998)
    Matiz, M200 / M250 (1998 - 2010)
    Spark, M300 (2010 - 2014)
    Lanos (1997 - 2002)
    Kalos (2002 - 2008)
    Aveo, T200 / T250 (2005 - 2011)
    Aveo, T300 (2011 - 2014)
    Nexia (1994 - 1997)
    Lacetti (2004 - 2010)
    Cruze, J300 / J305 / J308 (2009 - 2014)
    Volt (2011 - 2014)
    Nubira (1997 - 2010)
    Tacuma / Rezzo (2000 - 2009)
    Espero (1994 - 1999)
    Leganza (1997 - 2002)
    Evanda / Magnus, V200 (2002 - 2006)
    Epica, V250 (2006 - 2012)
    Malibu, V300 (2011 - 2015)
    Chairman (2004 - 2008)
    Trax / Tracker (2013 - 2014)
    Captiva, C100 (2006 - 2011)
    Captiva, C140 (2011 - 2014)
    Orlando, J309 (2010 - 2014)
    Camaro (2013 - )
    The models for Chevrolet (RUS) are:
    Spark (2011 - )
    Aveo (2002 - )
    Cobalt (2012 - )
    Cruze, J300 (2009 - )
    Epica (2006 - 2012)
    Lacetti, J242E (2010 - )
    Lanos (2002 - 2009)
    Niva, VAZ 2123 (2002 - )
    Rezzo (2002 - 2008)
    The models for Chevrolet (USA) are:
    Spark, M300 (2013 - )
    Aveo, T250 (2008 - 2011)
    Sonic, T300 (2012 - )
    Cruze, J300 (2010 - )
    Corsica (1989 - 1994)
    Beretta (1989 - 1995)
    Alero (1999 - 2004)
    Cobalt (2005 - 2010)
    Lumina (1994 - 2001)
    Malibu (2000 - )
    Malibu Maxx (2004 - 2007)
    Volt (2011 - )
    Impala (2000 - )
    Monte Carlo (2000 - 2007)
    SS (2014 - )
    Camaro (1993 - )
    Corvette (1983 - 2004)
    Corvette, C6 (2005 - 2013)
    Corvette, C7 (2014 - )
    Trans Sport (1996 - 2004)
    Uplander (2005 - 2008)
    Captiva (2013 - 2014)
    Trax (2015 - )
    Traverse, GMT561 (2009 - )
    HHR (2006 - 2011)
    SSR (2004 - 2006)
    Equinox (2005 - )
    Colorado (2006 - 2012)
    Colorado (2015 - )
    Blazer (1994 - 2005)
    TrailBlazer (2001 - 2009)
    Tahoe (1999 - 2005)
    Tahoe, GMT921 (2006 - 2013)
    Tahoe (2015 - )
    Express, GMT600 (1997 - 2002)
    Express, GMT601 (2003 - )
    Suburban, GMT830 (1999 - 2006)
    Suburban, GMT931 (2007 - 2013)
    Suburban (2015 - )
    Avalanche, GMT805 (2001 - 2006)
    Avalanche, GMT940 (2007 - 2013)
    Silverado, GMT800 (2002 - 2006)
    Silverado, GMT901 (2006 - 2013)
    Silverado (2014 - )
    The models for Chrysler (EU) are:
    ES (1986 - 1990)
    Delta (2011 - 2014)
    Ypsilon (2011 - 2015)
    Saratoga (1990 - 1994)
    PT Cruiser (1999 - 2010)
    Vision (1993 - 1997)
    GS (1988 - 1991)
    GTS (1988 - 1991)
    Neon (1994 - 2005)
    New Yorker (1988 - 1991)
    Sebring (2000 - 2010)
    Stratus, Cirrus (1994 - 2000)
    300M (1998 - 2004)
    300C (2005 - 2010)
    300C, LX (2011 - 2015)
    (Grand) Voyager, RT (1986 - 2015)
    The models for Chrysler (USA / CAN) are:
    Aspen (2006 - 2009)
    Crossfire (2003 - 2009)
    Neon (1999 - 2002)
    GS (1988 - 1991)
    Le Baron (1988 - 1995)
    PT Cruiser (1999 - 2010)
    Sebring (2000 - 2010)
    200 (2011 - )
    300M (1998 - 2004)
    300(C) (2005 - 2010)
    300, LX (2011 - )
    Newport (1988 - 1991)
    New Yorker (1988 - 1991)
    Fifth Avenue (1988 - 1989)
    Pacifica, CS (2003 - 2008)
    (Grand) Voyager / Town & Country, RT (1986 - )
    The models for Citroën are:
    2CV (1984 - 1991)
    LNA (1984 - 1988)
    AX (1986 - 1997)
    C-Zero (2010 - )
    C1 (2005 - 2014)
    C1, B4 (2014 - )
    Axel (1984 - 1990)
    ZX (1991 - 1998)
    C2 (2003 - 2010)
    Visa (1984 - 1988)
    Saxo (1996 - 2003)
    DS3, A55 (2010 - )
    C3 / Pluriel (2001 - 2009)
    C3, A51 (2009 - )
    C3 Picasso (2009 - )
    Xsara (1997 - 2005)
    Xsara Picasso (1999 - 2011)
    C-Elysée (2013 - )
    C4 (2004 - 2010)
    C4, B71 (2010 - )
    DS4, B75 (2011 - )
    C4 Cactus (2014 - )
    C4 Aircross (2012 - )
    C4 Picasso (2007 - 2013)
    C4 Picasso, B78 (2013 - )
    Grand C4 Picasso (2006 - 2013)
    Grand C4 Picasso, B78 (2013 - )
    GSA (1984 - 1987)
    BX (1982 - 1995)
    Xantia (1993 - 2001)
    C5 (2000 - 2009)
    C5, X7 (2008 - )
    CX (1983 - 1992)
    XM (1989 - 2001)
    DS5 (2011 - )
    C6 (2006 - 2013)
    Evasion / Synergie (1994 - 2002)
    C8 (2002 - 2013)
    C-Crosser (2007 - 2012)
    Nemo Multispace (2007 - )
    Berlingo Multispace (1996 - 2008)
    Berlingo Multispace, B9 (2008 - )
    Jumpy- / Dispatch Multispace (2007 - )
    Jumper- / Relay Combi (2007 - )
    The models for Dacia are:
    Previous models (1984 - 1999)
    Supernova, B41 (2000 - 2003)
    Solenza, B41 (2003 - 2005)
    Sandero, B90 (2008 - 2012)
    Sandero II, B52 (2012 - )
    Logan, L90\K90 (2004 - 2012)
    Logan II, L52\K52 (2012 - )
    Duster, H79 (2009 - )
    Lodgy, J92 (2012 - )
    Dokker, K67 (2013 - )
    The models for Daihatsu (EU) are:
    Cuore / Mira / Domino (1978 - 1998)
    Cuore / Mira / Charade (1998 - 2013)
    Trevis (2006 - 2009)
    Move (1996 - 2003)
    Gran Move (1996 - 2003)
    Sirion (1998 - 2005)
    Sirion 2 (2005 - 2010)
    Young RV (YRV) (2000 - 2007)
    Charade (1983 - 2001)
    Charade (2011 - 2013)
    Valéra (1994 - 2001)
    Charmant (1981 - 1987)
    Applause (1989 - 2001)
    Materia (2006 - 2011)
    Terios (1997 - 2012)
    Feroza / Sportrack (1988 - 1999)
    Taft (1974 - 1984)
    Rocky / Fourtrack (1984 - 2003)
    Copen (2003 - 2012)
    The models for Daihatsu (RUS) are:
    Mira (1998 - )
    Coo (2006 - 2011)
    Be-go (1997 - )
    Copen (2003 - )
    The models for Daimler are:
    Six / Double Six (1995 - 1998)
    V8 (1998 - 2002)
    Super Eight (2003 - 2007)
    The models for Datsun (RUS) are:
    mi-Do (2014 - )
    on-Do (2014 - )
    The models for Dodge (EU) are:
    Caliber, PM (2006 - 2012)
    Avenger (2007 - 2010)
    Viper, ZB (2003 - 2010)
    Nitro, KA (2006 - 2010)
    Journey (2007 - 2011)
    The models for Dodge (USA / CAN) are:
    Neon / SX (1994 - 2005)
    Dart, PF (2012 - )
    Caliber, PM (2006 - 2012)
    Avenger (2007 - 2014)
    Shadow (1986 - 1990)
    Challenger (2009 - )
    Charger, LX (2006 - )
    Magnum (2004 - 2008)
    Nitro, KA (2006 - 2012)
    Journey (2007 - )
    Stratus, Cirrus (1994 - 2000)
    (Grand) Caravan (2004 - )
    Durango, HB (2004 - )
    Dakota, ND (2004 - 2011)
    Viper, ZB (2003 - 2010)
    Viper, VX (2013 - )
    The models for DR are:
    DR Zero (2015 - )
    DR1 (2009 - 2012)
    DR2 (2010 - )
    DR5 (2007 - )
    CityCross (2011 - )
    

    【讨论】:

    • 感谢您的支持。但我真的有问题。我想做循环爬虫。就像是。奥迪然后是宾利宝马(欧盟)。你知道这样做吗?
    • 你想滚动选项的所有值吗?
    • @You.Brighton ..我提供了一种方法来首先获取汽车的所有选项,然后在下拉列表中选择所有值。请注意,这是提示代码,可能不是您问题的确切解决方案...请详细解释问题以便更好地理解
    • 对不起,这是我的错误。下次我会尝试写详细的。我厌倦了你的第二个代码。但它不起作用。你会一劳永逸地看到主要问题。我上传了图片说明
    • 表示您在选择汽车后需要控制台中所有汽车型号的型号详细信息,或者您想选择所有选项
    【解决方案2】:

    你应该改变 wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, "#ctl00_ContentPlaceHolder1_lstMake &gt; option")))wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "#ctl00_ContentPlaceHolder1_lstMake &gt; option")))

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-09-29
      • 1970-01-01
      • 2018-11-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-12
      • 1970-01-01
      相关资源
      最近更新 更多