![](/img/trans.png)
[英]Wait- Expected conditions not working for auto-suggestion within Yahoo Finance page using Selenium and Java
[英]Finding Buttons On Yahoo Finance using Selenium[JAVA]
我最近尝试从雅虎财务发现的财务报告中自动提取季度数据,但找不到解决方法。 我以为可以click
财务主页(Ex https://finance.yahoo.com/quote/SBUX/financials )上的buttons
,但是找不到找到Web元素的方法。 首先,我需要单击“ Balance Sheet
”按钮。
这是此按钮的所有HTML
代码:
<div class="Fz(s) Fw(500) D(ib) Pend(15px) H(18px)" data-reactid=".27ez98r5x0u.1.$0.0.0.3.1.$main-0-Quote-Proxy.$main-0-Quote.2.0.0.0.1.1:$balance.0">
<span data-reactid=".27ez98r5x0u.1.$0.0.0.3.1.$main-0-Quote-Proxy.$main-0- Quote.2.0.0.0.1.1:$balance.0.0">Balance Sheet
</span>
</div>
接下来,我需要找到并单击“ Quartely
”按钮
<div class="Fz(s) Fw(500) D(ib) Pend(15px) H(18px) C($finDarkLink):h Mend(15px) C($actionBlue)" data-reactid=".27ez98r5x0u.1.$0.0.0.3.1.$main-0-Quote-Proxy.$main-0-Quote.2.0.0.0.1.2.$1.0">
<span data-reactid=".27ez98r5x0u.1.$0.0.0.3.1.$main-0-Quote-Proxy.$main-0-Quote.2.0.0.0.1.2.$1.0.0">Quarterly
</span>
</div>
找到这些按钮的任何帮助或其他查找此财务信息的方法都将有所帮助。
查找使用Xpaths:
//button[contains(.,'Balance Sheet')]
//button[contains(.,'Quarterly')]
实际上,这些按钮在加载页面后就可以单击了,因此您应该尝试使用WebDriverWait
等待这些按钮变得可见并可以单击,如下所示:
String url = "https://finance.yahoo.com/quote/SBUX/financials";
driver.get(url);
WebDriverWait wait = new WebDriverWait(driver, 20);
WebElement balanceSheet = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//span[text() = 'Balance Sheet']")));
balanceSheet.click();
WebElement quarterly = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//span[text() = 'Quarterly']")));
quarterly.click();
是否有可能通过excel VBA从Yahoo财务中提取季度资产负债表。 我非常努力地借助VBA中的行情自动提取季度损益表,资产负债表和现金流量,我也无法提取一个特定的行项目,例如:收入或净收入或现金和现金等价物等,我是VBA的新手,只是初学者。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.