Java getTitle()在Selenium中未显示正确的输出

Java getTitle()在Selenium中未显示正确的输出,java,selenium,Java,Selenium,在下面的程序中;getTitle返回错误的o/P: public static void main(String[] args) throws InterruptedException { System.setProperty("webdriver.gecko.driver", "E:\\Technologies\\Automation-Selenium\\Selenium Files\\geckodriver.exe"); System.setProperty("we

在下面的程序中;getTitle返回错误的o/P:

public static void main(String[] args) throws InterruptedException {
   System.setProperty("webdriver.gecko.driver",
      "E:\\Technologies\\Automation-Selenium\\Selenium Files\\geckodriver.exe");

   System.setProperty("webdriver.ie.driver",
      "E:\\Technologies\\Automation-Selenium\\Selenium Files\\IEDriverServer.exe");

   WebDriver driver = new InternetExplorerDriver();

   driver.get("https://www.google.co.in");

   String title = driver.getTitle();

   System.out.println(title);
}
Eclipse中的输出: 网络驱动程序
为什么不使用Google?

通常equals不能很好地处理字符串。 你能用iftitle.equalsIgnoreCaseGoogle解决你的问题吗

这发生在IEdriver上;因为无论何时首先启动IEDriver,它都会打开以下带有WebDriver标题的屏幕:


因此,您只需再等几秒钟,它就会导航到实际的URL,例如在您的案例www.google.com中。

最后,我得到了正确的答案。我们需要在所有区域设置相同的安全级别。要执行此操作,请执行以下步骤:

开放式IE 转到工具->互联网选项->安全 将所有区域设置为相同的保护模式,启用或禁用都无关紧要。 最后,将缩放级别设置为100%
它也显示了相同的输出。顺便说一句,谢谢你的回复,这是正确的,它只发生在IEdriver中,但是等待在这里也不起作用;wait.untilExpectedConditions.titleContainsgoogle.com;