Python 3 Selenium选择下拉菜单。无法找到下拉菜单

时间:2019-11-15 07:28:07

标签: python selenium drop-down-menu element inspect-element

我在下拉按钮上的位置有问题,它没有ID或唯一的类,在下拉栏上也没有文本,我不确定如何找到它。有什么建议吗? 这是我的代码;

## Opens up BrightSpace  and selects new notification 
from selenium import webdriver
from selenium.webdriver.support.ui import Select
import email_infor
import time
username = email_infor.Data_username
password = email_infor.Data_password
url = 'https://login.microsoftonline.com/ec1bd924-0a6a-4aa9-aa89-c980316c0449/saml2?SAMLRequest=jZE9b4MwEED3Sv0PyDvYBkzAgkhRu0RKl6Tt0KUycCFIxiY%2bU%2fXn12mUKmO3%2b9Cd3rurN4s%2fmT2cF0AfbZ8bgmrS7pp%2frgpx7PJSsbxI81XPKqGKVZUzdlSFKHlGondwOFrTkDRhJNoiLrA16JXxocR4FXMec%2fHKMskzmVZJzkWZZ%2bKDRBtEcD7MPlmDywTuAO5r7OBtv2vIyfsZJaWtG4eTx1l1kCg9WHNeRtNZrWGApLMT7VNN9UxVsKDaDqOhF%2f7dJUpCj0TfkzbYkMUZaRWOKI2aAKXv5GHzspMBW87OehuWkvXjQxTVvxLuP4PqpkDWN%2bBepEr0HGLVVnkcbKu4beEYBwHGqqzgRd8lHkw4ECb3dheZP%2fSaXiECUE3vP7T%2bAQ%3d%3d'
driver = webdriver.Chrome()
driver.get(url)
time.sleep(3)
driver.find_element_by_id('i0116').send_keys(username)
driver.find_element_by_id('idSIButton9').click()

time.sleep(3)
driver.find_element_by_id('passwordInput').send_keys(password)
driver.find_element_by_id('submitButton').click()

time.sleep(.5)
driver.find_element_by_id('idBtn_Back').click()

time.sleep(10)
drop = driver.find_element_by_class_name('d2l-htmlblock d2l-htmlblock-deferred d2l-htmlblock-untrusted')
print(drop)

HTML:
<div class="d2l-htmlblock d2l-htmlblock-deferred d2l-htmlblock-untrusted">
<p>The clock has started on Lab 7!</p>
<p><br>Don't wait to have me sign off on your proposal to start your research into your project idea.</p>
<p><br>The more wholly thought out the idea, the better when submitting your proposal.<br>The folks who have submitted, we will go over your proposal this week in lab class.<br>Everyone else, you are using up lab time that could be used to work on the project itself.<br>Please get the proposals into Brightspace as soon as possible.<br>I have pushed back the deadline for the 2nd time.</p>
<p><br>The lab is out of 100 marks. <br>Up to 20 marks will be given based on your level of communication with me. <br>The technical evaluation part of the lab is worth up to 80 marks.</p>
<p><br>You must document all your research, all code you write, block diagrams, circuit diagrams (pneumatic or electrical), packet traces, etc. 
 <br>Use notepad or some other text editor to take notes for all work on your project. <br>Record each activity along with the time and date.</p>
<p><br>Listed are the three levels of technical evaluation and the associated 
mark range : <br>Level 1 up to 35, Level 2 - up to 25, Level 3 up to 20. 
 <br>For each project, we will negotiate milestones and deliverables that 
have 
to be met to achieve each level in the technical evaluation.<br>You need to 

在获得分数之前,达到每个级别的所有商定里程碑    进入下一个级别。

0 个答案:

没有答案