I am trying to switch my iframe to an iframe that's id changes every time. The source code is here:
<iframe class="card-fields-iframe ui-droppable" frameborder="0" id="card-fields-verification_value-f9yavo67out00000" name="card-fields-verification_value-f9yavo67out00000" scrolling="no" src="https://checkout.shopifycs.com/verification_value?identifier=b5fa1aecc18e4f685d7408c699c2ac5b&location=https%3A%2F%2Fyeezysupply.com%2F17655971%2Fcheckouts%2Fb5fa1aecc18e4f685d7408c699c2ac5b%3F_ga%3D2.184035750.1808724638.1545611726-2044927600.1545611726&dir=ltr" title="Field container for: CVV" style="height: 42px;" xpath="1"></iframe>
This is what I have tried. This has worked on the other iframes but not working on this one.
WebElement cVV = driver.findElement(By.xpath("//iframe[contains(@src,'verification')]"));
driver.switchTo().frame(cVV);
I also tried with starts-with but still no luck. If there is a different approach that I am not aware of please let me know.