Open SPTAU opened 5 years ago
更新驱动就已经耗去我半条命了,这个#menu-container 我真的看不懂了
以及,我在网页源代码里面好像搜不到ccss1、ccss2和css里面的东西,所以是id的问题?还是什么?
兄弟 期末不用考试吗?
lkncyjn2013 notifications@github.com于2018年12月28日 周五下午1:23写道:
以及,我在网页源代码里面好像搜不到ccss1、ccss2和css里面的东西,所以是id的问题?还是什么?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ETCartman/Class_Npels/issues/8#issuecomment-450292407, or mute the thread https://github.com/notifications/unsubscribe-auth/AYHrW-9OzuhXR-pCcvXTOU9VfrKFwJr0ks5u9arPgaJpZM4Zjdpe .
复习ing
我其实已经忘了,如果没记错的话网课是分两部分的一个听说一个读写,这两个css对应两个部分在网页上的位置。 https://github.com/ETCartman/Class_Npels/blob/3503e9c5cea0e48cef0593db61e66aecae06197d/Class_Npels.py#L22-L23
只找到了这个
<div class="class_container">
<div class="class_mag_3">
<ul>
<a onclick="location.href='CourseIndex.aspx?c=2018-0007-0013&m=College_English_NEW_Century_SecEdition_Integration_1'">
<li class="class_mag_3_1">
<img src="http://222.200.97.180/course/College_English_NEW_Century_SecEdition_Integration_1/cover.jpg"></li>
<li class="class_mag_3_2"> 新世纪大学英语(第二版)综合教程第一册</li>
<li class="progress_1"><span id="sp_2018-0007-0013_College_English_NEW_Century_SecEdition_Integration_1" style='width: 37%'></span></li>
<li class="class_mag_1_4"> 新世纪大学英语(第二版)综合教程第一册</li>
</a>
</ul>
<ul>
<a onclick="location.href='CourseIndex.aspx?c=2018-0007-0013&m=College_English_NEW_Century_Video_ThirdEdition_1'">
<li class="class_mag_3_1">
<img src="http://222.200.97.180/course/College_English_NEW_Century_Video_ThirdEdition_1/cover.jpg"></li>
<li class="class_mag_3_2"> 新世纪大学英语(第二版)视听说教程(3rd Edition)第一册</li>
<li class="progress_1"><span id="sp_2018-0007-0013_College_English_NEW_Century_Video_ThirdEdition_1" style='width: 37%'></span></li>
<li class="class_mag_1_4"> 新世纪大学英语(第二版)视听说教程(3rd Edition)第一册</li>
</a>
</ul>
</div>
</div>
改成这样
self.ccss1 = '#class_container > div > ul:nth-child(1) > a'
self.ccss2 = '#class_container > div > ul:nth-child(2) > a'
弹出
Traceback (most recent call last):
File "run.py", line 22, in
明年再说,谢谢这位兄弟
ok
Traceback (most recent call last): File "run.py", line 22, in
a.ready()
File "……\Class_Npels.py", line 63, in ready
self.start(i)
File "……\Class_Npels.py", line 77, in start
self.driver.find_element_by_css_selector(self.ccss1).click()
File "……\Python\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 509, in find_element_by_css_selector
return self.find_element(by=By.CSS_SELECTOR, value=css_selector)
File "……\Python\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 843, in find_element
'value': value})['value']
File "……\Python\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 308, in execute
self.error_handler.check_response(response)
File "……\Programs\Python\Python35\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 194, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"#menu-container > ul > li:nth-child(3) > a"}
(Session info: chrome=71.0.3578.98)
(Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.17134 x86_64)