Selenium中的current_url函数用于获取当前浏览器窗口的URL。如果你发现这个函数显示了错误的地址,可能是由以下几个原因造成的: 基础概念 Selenium: 是一个用于Web应用程序测试的工具,它模拟浏览器行为,支持多种浏览器。 current_url:是Selenium WebDriver的一个属性,用于获取当前页面的URL。 可能的原因及解决方法 页面...
问Selenium中的"Current_url“函数显示错误的地址EN双折线点击一个,另一显示a b 错误.PNG 正确.PNG ...
问题:打开当前页面--1,点击按钮后重新打开窗口--2,此时执行current_url,获取到的url为窗口1的url 解决方法: switch_to.window(窗口2句柄),然后再执行current_url,就可获取窗口2的url
@Test public void testQRCodeValidation() { performLogin(username); assertEquals(zoneUrl + "/login/mfa/register", webDriver.getCurrentUrl()); webDriver.findElement(By.id("Next")).click(); assertEquals(zoneUrl + "/login/mfa/verify", webDriver.getCurrentUrl()); webDriver.findElement(By.name(...
driver.navigate().back();//返回第一次访问的网页,即后退功能System.out.println("当前打开页面的标题是:" + driver.getTitle());//打印标题System.out.println("当前页面的网址是: " + driver.getCurrentUrl());//打印当前网址Thread.sleep(5000); ...
Description Switching parent window to child window, which is opening with a PDF in Chrome Browser, which is the third tab in browser. Trying to capture the URL for PDF opening with new tab, getting a Chrome-extension URL. 2.Trying to la...
Originally reported on Google Code with ID 6309 My Use Case: Switching windows until the url contains a defined string. Source Code: public void switchWindowByUrl(ApplicationEnum urlPart) { boolean foundWindow = false; for (String winHan...
{"id":"d54cb226-42e2-493a-9965-c05d209da23a","version":"2.0","name":"test-google-search","url":"https://www.google.com","tests":[{"id":"c0283e5a-8cbd-492f-8b3d-f2476f319264","name":"search instana","commands":[{"id":"cd6aaf21-62f8-4d7f-af0a-5fe8beee8fde","...
URL :URL 是统一资源定位符的缩写,被定义为万维网上文档和其他资源的全球地址,例如,要访问 GeeksforGeeks 网站,您将进入 URL https://www.geeksforgeeks.org/。 语法: driver.current_url 参数: 不需要争论。 返回值:返回字符串格式的网址。 Code 1: ...
原文:https://www . geesforgeks . org/current _ URL-driver-method-selenium-python/Selenium 的 Python 模块是为使用 Python 执行自动化测试而构建的。Selenium Python 绑定提供了一个简单的应用编程接口,可以使用Selenium网络驱动程序编写功能/验收测试。要使用Selenium Python 打开网页,请使用 get 方法-Selenium ...