 <?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-CN">
		<id>http://wiki.sseuu.com/index.php?action=history&amp;feed=atom&amp;title=Selenium%E4%BE%8B%E5%AD%90-1</id>
		<title>Selenium例子-1 - 版本历史</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.sseuu.com/index.php?action=history&amp;feed=atom&amp;title=Selenium%E4%BE%8B%E5%AD%90-1"/>
		<link rel="alternate" type="text/html" href="http://wiki.sseuu.com/index.php?title=Selenium%E4%BE%8B%E5%AD%90-1&amp;action=history"/>
		<updated>2026-04-07T04:08:38Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://wiki.sseuu.com/index.php?title=Selenium%E4%BE%8B%E5%AD%90-1&amp;diff=119830&amp;oldid=prev</id>
		<title>2023年3月11日 (六) 23:58 笑笑</title>
		<link rel="alternate" type="text/html" href="http://wiki.sseuu.com/index.php?title=Selenium%E4%BE%8B%E5%AD%90-1&amp;diff=119830&amp;oldid=prev"/>
				<updated>2023-03-11T23:58:28Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;zh-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2023年3月11日 (六) 23:58的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l52&quot; &gt;第52行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第52行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; driver.get('https://www.taobao.com/')&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; driver.get('https://www.taobao.com/')&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; next_page()&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; next_page()&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;----&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;来自：[https://www.bilibili.com/video/av419863231/?zw&amp;amp;spm_id_from=888.80996.embed_old&amp;amp;vd_source=adccf09323887c981a2c590edd4977da]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>笑笑</name></author>	</entry>

	<entry>
		<id>http://wiki.sseuu.com/index.php?title=Selenium%E4%BE%8B%E5%AD%90-1&amp;diff=119829&amp;oldid=prev</id>
		<title>江南仁：创建页面，内容为“from selenium.webdriver.common.by import By import time import re  def search_product():     driver.find_element(By.XPATH, ('//*[@id=&quot;q&quot;]')).send_keys(kw)     driver...”</title>
		<link rel="alternate" type="text/html" href="http://wiki.sseuu.com/index.php?title=Selenium%E4%BE%8B%E5%AD%90-1&amp;diff=119829&amp;oldid=prev"/>
				<updated>2023-03-11T13:54:36Z</updated>
		
		<summary type="html">&lt;p&gt;创建页面，内容为“from selenium.webdriver.common.by import By import time import re  def search_product():     driver.find_element(By.XPATH, (&amp;#039;//*[@id=&amp;quot;q&amp;quot;]&amp;#039;)).send_keys(kw)     driver...”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;from selenium.webdriver.common.by import By&lt;br /&gt;
import time&lt;br /&gt;
import re&lt;br /&gt;
&lt;br /&gt;
def search_product():&lt;br /&gt;
    driver.find_element(By.XPATH, ('//*[@id=&amp;quot;q&amp;quot;]')).send_keys(kw)&lt;br /&gt;
    driver.find_element(By.XPATH, ('//*[@id=&amp;quot;J_TSearchForm&amp;quot;]/div[1]/button')).click()&lt;br /&gt;
    time.sleep(10)&lt;br /&gt;
    page = driver.find_elements(By.XPATH, ('//*[@id=&amp;quot;mainsrp-pager&amp;quot;]/div/div/div/div[1]')).text&lt;br /&gt;
    page = int(re.compile('(\d+)').search(page).group(1))&lt;br /&gt;
    return page&lt;br /&gt;
&lt;br /&gt;
def drop_down():&lt;br /&gt;
    for x in range(1,11,2):&lt;br /&gt;
        time.sleep(0.5)&lt;br /&gt;
        j = x/10&lt;br /&gt;
        js = 'document.documentElement.scrollTop = document.documentElement.scrollHeight * %f'%j&lt;br /&gt;
        driver.execute_script(js)&lt;br /&gt;
&lt;br /&gt;
def get_product():&lt;br /&gt;
    divs = driver.find_elements(By.XPATH,('//*[@id=&amp;quot;mainsrp-itemlist&amp;quot;]/div/div/div[1]/div[1]'))&lt;br /&gt;
    for div in divs:&lt;br /&gt;
        picture = div.find_elements(By.XPATH,('.//div[@class=&amp;quot;pic&amp;quot;]/a/img')).get_attribute('src')&lt;br /&gt;
        introduce = div.find_elements(By.XPATH,('.//div[@class=&amp;quot;price g_price g_price-highlight&amp;quot;]/strong')).text&lt;br /&gt;
        price = div.find_elements(By.XPATH, ('.//div[@class=&amp;quot;row row-2 title&amp;quot;]/a')).get_attribute('trace-price') + '元'&lt;br /&gt;
        sales = div.find_elements(By.XPATH,('.//div[@class=&amp;quot;deal-cnt&amp;quot;]')).text&lt;br /&gt;
        name = div.find_elements(By.XPATH, ('.//div[@class =&amp;quot;row row-2 title&amp;quot;]/a/span[2]')).text&lt;br /&gt;
        place = div.find_elements(By.XPATH, ('.//div[@class=&amp;quot;location&amp;quot;]')).text&lt;br /&gt;
        product = {'图片':picture,'介绍':introduce,'价格':price,'销售':sales,'名字':name,'地点':place}&lt;br /&gt;
        print(product)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def next_page():&lt;br /&gt;
    page = search_product()&lt;br /&gt;
    drop_down()&lt;br /&gt;
    get_product()&lt;br /&gt;
    num = 1&lt;br /&gt;
    while num != page:&lt;br /&gt;
        driver.get('https://s.taobao.com/search?q={}&amp;amp;s={}'.format(kw, 44*num))&lt;br /&gt;
        driver.implicitly_wait(10)&lt;br /&gt;
        num += 1&lt;br /&gt;
        drop_down()&lt;br /&gt;
        get_product()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == '__main__':&lt;br /&gt;
    kw = input('请输入你想搜索的商品:')&lt;br /&gt;
    options = webdriver.ChromeOptions()&lt;br /&gt;
    options.add_experimental_option(&amp;quot;detach&amp;quot;, True)&lt;br /&gt;
    driver = webdriver.Chrome(options=options)&lt;br /&gt;
    driver.get('https://www.taobao.com/')&lt;br /&gt;
    next_page()&lt;/div&gt;</summary>
		<author><name>江南仁</name></author>	</entry>

	</feed>