Python 中的 Selenium(Webdriver) 没有 return Google AdWords 页面中的所有链接

Selenium(Webdriver) in Python doesn't return all links in Google AdWords page

我使用 selenium 的 webdriver 从 Google AdWords 下载报告。问题是,似乎 webdriver 没有 return 页面中的所有 links。如所附照片所示,当我获取页面源时,只有左侧的 link 被 return 编辑。我需要点击 "Run now" link 在 HTML:

中看起来像这样
<a href="#" onclick="return false;" actionid="runNow" style="white-space:nowrap">Run now</a>

如有任何意见,我们将不胜感激。

以下是我到目前为止编写的代码:

baseurl = "https://accounts.google.com/ServiceLogin?service=adwords&continue=https://adwords.google.com/um/identity?ltmpl%3Djfk%26hl%3Den_US&hl=en_US&ltmpl=jfk&passive=0&skipvpage=true"

username = "myUsername"

password = "myPassword"

xpaths = { 'usernameTxtBox' : "//input[@name='Email']",
           'passwordTxtBox' : "//input[@name='Passwd']",
           'submitButton' :   "//input[@name='signIn']"
         }

mydriver = webdriver.Firefox()
mydriver.get(baseurl)
mydriver.maximize_window()

#Clear Username TextBox if already allowed "Remember Me" 
mydriver.find_element_by_xpath(xpaths['usernameTxtBox']).clear()

#Write Username in Username TextBox
mydriver.find_element_by_xpath(xpaths['usernameTxtBox']).send_keys(username)

#Clear Password TextBox if already allowed "Remember Me" 
mydriver.find_element_by_xpath(xpaths['passwordTxtBox']).clear()

#Write Password in password TextBox
mydriver.find_element_by_xpath(xpaths['passwordTxtBox']).send_keys(password)

#Click Login button
mydriver.find_element_by_xpath(xpaths['submitButton']).click()

#Here when I print the source, I do not see any element from the table in the middle of the page
print mydriver.page_source

最后我想出了如何完成它,方法是在打开 url 之前添加以下代码:

mydriver.implicitly_wait(60) 

然后:

driver.find_element_by_link_text("Run now").click()

隐式等待等待从 DOM 加载元素。所以这是唯一的解决方案。