0

I failed to get a hidden link under a <ul>. driver.find_element_by_link_text('5641B07'), the code is OK, but if I want to find other links, failed to get them, like '5641CM6' Anybody can tell me how to get the hidden link click? and how could I get all the links from the <ul>?

enter image description here

the <ul> structure is similar like:

<ul>
  <li> <a> XXX</a> </li>
  <li> <a> YYY</a> </li>
  <li> 
    <a>Add software</a>
    <ul>
      <li> <a> A </a> </li>
      <li> <a> B </a> </li>
      <li> <a> C </a> </li>
      ...........
      <li> <a> Z </a> </li>
    </ul>
   </li>

from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
driver=webdriver.Firefox()
driver.get("https://www-01.ibm.com/products/hardware/configurator/americas/bhui/launchNI.wss")
driver.find_element_by_id("modelnumber").send_keys('8038AC1')
driver.find_element_by_name("submit").click()
driver.find_element_by_id("continueTop").click()
el_addSoftware=driver.find_element_by_link_text('Add software')
builder=ActionChains(driver)
builder.move_to_element(el_addSoftware).perform()
driver.find_element_by_link_text('5641CM6').click()
4

1 回答 1

0

这不是一个正常的下拉菜单。

你可以使用这样的东西

WebUtilities.executeScript(driver, "$('.context_menu').show()");

将 '.context_menu' 替换为您各自的 css 选择器

显示列表后单击所需选项。

于 2013-07-25T06:41:46.430 回答