https登录请求-Selenium WebDriver [英] https login request - selenium webdriver

查看:121
本文介绍了https登录请求-Selenium WebDriver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图访问https登录URL来登录页面并执行我的操作,但是无法执行同样的操作.

I was trying to access a https login url to login to a page and do my actions, but unable to do the same.

这些是我的观察结果.

当我点击实际网址时,在内部指向另一个附加了 JSESSION ID 的网址,然后加载请求的页面[现在已形成实际网址].

When I hit the actual url, internally its leading to another url having JSESSION ID appended to it and then loading the requested page [now actual url formed].

步骤:

  • 实际网址类似于: https:/abcd.xyz.com:7443/abcd/Web/Admin

当我点击上面的URL driver.get("https:/abcd.xyz.com:7443/abcd/Web/Admin"); 并在测试运行时将Jsession id附加到另一个网址,如下所示, https:/abcd.xyz.com:7443/abcd/loginAsGuest.jsp; jsessionid = z712Ty0Rn0BHLTH6Q2Q02cBj233L0JHwNhy7vxW9ntNZDbLJLxQT!-840704556

when I hit the above url driver.get("https:/abcd.xyz.com:7443/abcd/Web/Admin"); and when the test is running it appended Jsession id to another url, it looks like below, https:/abcd.xyz.com:7443/abcd/loginAsGuest.jsp;jsessionid=z712Ty0Rn0BHLTH6Q2Q02cBj233L0JHwNhy7vxW9ntNZDbLJLxQT!-840704556

然后,实际的网址是在加载页面的情况下形成的[ https://abcd.xyz.com:7443/abcd/Web/Admin ].

Then actual url is formed [https://abcd.xyz.com:7443/abcd/Web/Admin] with the page loaded.

在这里,我的问题是,我的脚本没有从那里继续执行,并由于无法登录页面而出现 NoSuchElementFound 异常.

Here my problem is, my script is not proceeding from there and getting NoSuchElementFound exception due to which am not able to login to the page.

任何解决上述问题的帮助都将非常有用.

Any help in resolving the above issue will be very much useful.

我的Webdriver代码如下:

My Webdriver code looks like :

FirefoxProfile profile = new FirefoxProfile();
profile.setAssumeUntrustedCertificateIssuer(false);
WebDriver driver = new FirefoxDriver();
driver.get("https://abcd.xyz.com:7443/abcd/Web/Admin");
WebElement uname = driver.findElement(By.name("username"));
WebElement pwd = driver.findElement(By.name("password"));

日志显示如下内容:

线程"main"中的异常org.openqa.selenium.NoSuchElementException:无法找到元素:{方法":名称",选择器":用户名"}

Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"name","selector":"username"}

任何解决上述问题的帮助都将非常有用.

Any help in resolving the above issue will be very much useful.

谢谢,
-阿尼尔09566212889

Thanks,
-Anil 09566212889

推荐答案

我认为这对您有用...

I think it will be useful for you...

FirefoxDriver Driver=new FirefoxDriver();
Driver.get("http://www.gmail.com");
Thread.sleep(1000);
Driver.findElement(By.id("Email")).sendKeys("xx");
Driver.findElement(By.id("Passwd")).sendKeys("xx");
Driver.findElement(By.id("signIn")).click();
Thread.sleep(10000);

这篇关于https登录请求-Selenium WebDriver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆