java - How to pass the value from one method to another method -
i have doubt in java selenium webdriver. example: on page 1 (personal details page) filling personal details , selecting payment method (like credit or debit card) using checkbox. on page 2 (dispatch): filling dispatch address details. on page 3 (payment page): based on selection page 1 payment should selected automatically.
i created 1 class file methods pages. dont know how pass value 1 method another.
kindly me resolve issue.
//class file package logintest; //import org.openqa.selenium.by; public class mobclas { private static webelement element=null; public static class mobile { public static webelement personal_details(webdriver driver) { //code driver.findelement(by.id("name")).sendkeys("test"); driver.findelement(by.id("mobile_no")).sendkeys("963258741"); driver.findelement(by.id("mail_id")).sendkeys("test@test.com"); //payment method selection if checkbox true, have pass value "paymentpage method" } public static webelement dispatchdetails(webdriver driver) { //code } public static webelement paymentpage(webdriver driver) { //value if true credit card payment else debit card payment } } }
you have 2 options:
1.pass values method arguments 2.create class property, , use value inside class methods.
do tried them?
Comments
Post a Comment