简体   繁体   中英

automation login to a website does not lead to the same page without automation (selenium)

I want to do some automation for a website using selenium and there is a login password to enter and when I automate the login it goes to one page, and when im not automating it goes to another(the right one)...the login info are identical and there is no explanation in the landing pages that will explain the behaviour...does anyone know if this means that the website added some security features that will detect automation?... I dont know even if its possible..will love to get help

this is what im doing:

driver.get("https://somewebsite")


val userNameTextFieldLocator: WebElement = driver.findElement(By.id("username"))
userNameTextFieldLocator.sendKeys("vvv")


val passwordTextFieldLocator: WebElement = driver.findElement(By.id("password"))
passwordTextFieldLocator.sendKeys("vvvv")


val pinNumLocator = driver.findElement(By.id("pinnumber"))
pinNumLocator.sendKeys("vvvv")

val logginButton: WebElement = driver.findElement(By.className("login_button"))
logginButton.click()

Then I see this security popup:

在此处输入图片说明

then to continue I go:

val alert: Alert = wait.until(ExpectedConditions.alertIsPresent())
    alert.accept()

before initialize the driver try to:

DesiredCapabilities cap = DesiredCapabilities.chrome();
cap.setCapability("chrome.switches", Arrays.asList("--ignore-certificate-errors"));

driver = new ChromeDriver(cap);

Get the header Text from the Window Popup or the New page.

Next have a if-else case , if you get the above mentioned error-- Refer to these

Handle Securtiy Warning pop-up in FireFox with Selenium IDE

How to Click a option in Security Warning dialog box using Selenium?

If not, do as usual.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM