第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何從Selenium獲取元素的屬性?

如何從Selenium獲取元素的屬性?

慕妹3242003 2019-09-03 17:08:47
我在Python中使用Selenium。我想得到.val()一個<select>元素,并檢查它是我期望的。這是我的代碼:def test_chart_renders_from_url(self):    url = 'http://localhost:8000/analyse/'    self.browser.get(url)    org = driver.find_element_by_id('org')    # Find the value of org?我怎樣才能做到這一點?Selenium文檔似乎有很多關(guān)于選擇元素但沒有關(guān)于屬性的內(nèi)容。
查看完整描述

3 回答

?
一只甜甜圈

TA貢獻1836條經(jīng)驗 獲得超5個贊

你可能正在尋找get_attribute()。一個例子示此處以及


def test_chart_renders_from_url(self):

    url = 'http://localhost:8000/analyse/'

    self.browser.get(url)

    org = driver.find_element_by_id('org')

    # Find the value of org?

    val = org.get_attribute("attribute name")


查看完整回答
反對 回復(fù) 2019-09-03
?
幕布斯7119047

TA貢獻1794條經(jīng)驗 獲得超8個贊

蟒蛇


element.get_attribute("attribute name")

Java的


element.getAttribute("attribute name")

紅寶石


element.attribute("attribute name")

C#


element.GetAttribute("attribute name");


查看完整回答
反對 回復(fù) 2019-09-03
  • 3 回答
  • 0 關(guān)注
  • 939 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號