Automation script using Selenium tool [duplicate]
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
This question already has an answer here:
selenium.common.exceptions.ElementNotVisibleException: Message: element not interactable using Selenium
1 answer
ElementNotVisibleException : Selenium Python
1 answer
selenium.common.exceptions.ElementNotVisibleException: Message: element not visible while trying to access an element with Python + Selenium
3 answers
I need help with my automation script.
First I need to click add button so it will open device id and device name text box. I am passing a value to that text box from excel sheet using filo and clicking on save. I am reading data from excel sheet. For any existing value, it will fetch data from excel sheet one by one. But if I enter new data in the sheet and try to fetch it will throw an error
element not visible
This is my script:
public void Click_Smart_Cart_Button() throws IOException, FilloException, InterruptedException
{
System.out.println(".....Click operation on Add_Smart_Cart_Device button......");
WebElement smart_cart_btn=driver.findElement(By.xpath(rx.readdatafromexcel("sheet1", 1,1)));
WebDriverWait wait2=new WebDriverWait(driver,15);
wait2.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(rx.readdatafromexcel("sheet1",1,1))));
mod.click(smart_cart_btn);
System.out.println(" ");
System.out.println("....Button is clicked Successfully....");
System.out.println(" ");
// Operation to Retrieve data from the Excel Sheet "TestData"
Fillo fillo= new Fillo();
Connection con=fillo.getConnection(Filepath);
String query = "Select SmartCartDeviceID, SmartCartDeviceName from Sheet1";//the parameters name and column name in excel sheet must be same.Eg "username"
Recordset results= con.executeQuery(query);
while(results.next()){
//Click on Device id text box and send data from sheet
System.out.println("....Click operation on Smart Card Device id text box....... ");
System.out.println(" ");
WebElement click_id_box=driver.findElement(By.xpath(rx.readdatafromexcel("sheet1", 2,1)));
if(click_id_box.isDisplayed()==false)
{
driver.manage().timeouts().implicitlyWait(6, TimeUnit.SECONDS);
mod.click(smart_cart_btn);
}
mod.click(click_id_box);
System.out.println("......Smart card device id box is clicked Sucessfully.....");
System.out.println(" ");
System.out.println("....Checking whther the id box field is empty or not...");
System.out.println(" ");
if(click_id_box != null)
{
click_id_box.clear();
}
click_id_box.sendKeys(results.getField("SmartCartDeviceID"));
Thread.sleep(1000);
System.out.print("Device id is "+results.getField("SmartCartDeviceID") +" ");
System.out.println(" ");
System.out.println("......Device id is sent succefully from the excel sheet.....");
System.out.println(" ");
//Click on Device name text box and send data from the sheet
System.out.println(".....Click operation on Smart Card Device Name Text Box...");
System.out.println(" ");
WebElement click_name_box=driver.findElement(By.xpath(rx.readdatafromexcel("sheet1", 3,1)));
mod.click(click_name_box);
System.out.println("......Smart Cart Device id box is clicked Successfully....");
System.out.println(" ");
System.out.println("....Checking whther the Device name box field is empty or not.....");
System.out.println(" ");
if( click_name_box!=null)
{
click_name_box.clear();
}
click_name_box.sendKeys(results.getField("SmartCartDeviceName"));
Thread.sleep(2000);
System.out.println(" Device Name is "+results.getField("SmartCartDeviceName"));
System.out.println(" ");
System.out.println("....Device name is sent successfully from the excel sheet.....");
System.out.println(" ");
//Click on Save button after sending values to the respective text boxes
System.out.println("...Click on Save button....");
WebElement save_btn=driver.findElement(By.xpath(rx.readdatafromexcel("sheet1",4,1)));
mod.click(save_btn);
Thread.sleep(2000);
System.out.println(" ");
System.out.println("......Save button is clicked successfully.....");
//Handle Confirmation Pop up
System.out.println(" ");
System.out.println(".....After click on save confimation window will appear....");
System.out.println(" ");
WebDriverWait wait=new WebDriverWait(driver,30);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(rx.readdatafromexcel("sheet1",5,1))));
System.out.println("....Wait for element to be clickable.....");
WebElement ok_pop=driver.findElement(By.xpath(rx.readdatafromexcel("sheet1", 5,1)));
mod.click(ok_pop);
Thread.sleep(2000);
System.out.println(" ");
System.out.println("....Successfully clicked on confirmation ok.....");
System.out.println(" ");
System.out.println(".....Successfully completed data retrievation from excel sheet.....");
System.out.println(" ");
}
}
}
readfromexcel is my function for reading data from excel. It contain xpath of all webelement.
java excel selenium-webdriver
marked as duplicate by Corey Goldberg, DebanjanB
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 5 at 10:27
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
selenium.common.exceptions.ElementNotVisibleException: Message: element not interactable using Selenium
1 answer
ElementNotVisibleException : Selenium Python
1 answer
selenium.common.exceptions.ElementNotVisibleException: Message: element not visible while trying to access an element with Python + Selenium
3 answers
I need help with my automation script.
First I need to click add button so it will open device id and device name text box. I am passing a value to that text box from excel sheet using filo and clicking on save. I am reading data from excel sheet. For any existing value, it will fetch data from excel sheet one by one. But if I enter new data in the sheet and try to fetch it will throw an error
element not visible
This is my script:
public void Click_Smart_Cart_Button() throws IOException, FilloException, InterruptedException
{
System.out.println(".....Click operation on Add_Smart_Cart_Device button......");
WebElement smart_cart_btn=driver.findElement(By.xpath(rx.readdatafromexcel("sheet1", 1,1)));
WebDriverWait wait2=new WebDriverWait(driver,15);
wait2.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(rx.readdatafromexcel("sheet1",1,1))));
mod.click(smart_cart_btn);
System.out.println(" ");
System.out.println("....Button is clicked Successfully....");
System.out.println(" ");
// Operation to Retrieve data from the Excel Sheet "TestData"
Fillo fillo= new Fillo();
Connection con=fillo.getConnection(Filepath);
String query = "Select SmartCartDeviceID, SmartCartDeviceName from Sheet1";//the parameters name and column name in excel sheet must be same.Eg "username"
Recordset results= con.executeQuery(query);
while(results.next()){
//Click on Device id text box and send data from sheet
System.out.println("....Click operation on Smart Card Device id text box....... ");
System.out.println(" ");
WebElement click_id_box=driver.findElement(By.xpath(rx.readdatafromexcel("sheet1", 2,1)));
if(click_id_box.isDisplayed()==false)
{
driver.manage().timeouts().implicitlyWait(6, TimeUnit.SECONDS);
mod.click(smart_cart_btn);
}
mod.click(click_id_box);
System.out.println("......Smart card device id box is clicked Sucessfully.....");
System.out.println(" ");
System.out.println("....Checking whther the id box field is empty or not...");
System.out.println(" ");
if(click_id_box != null)
{
click_id_box.clear();
}
click_id_box.sendKeys(results.getField("SmartCartDeviceID"));
Thread.sleep(1000);
System.out.print("Device id is "+results.getField("SmartCartDeviceID") +" ");
System.out.println(" ");
System.out.println("......Device id is sent succefully from the excel sheet.....");
System.out.println(" ");
//Click on Device name text box and send data from the sheet
System.out.println(".....Click operation on Smart Card Device Name Text Box...");
System.out.println(" ");
WebElement click_name_box=driver.findElement(By.xpath(rx.readdatafromexcel("sheet1", 3,1)));
mod.click(click_name_box);
System.out.println("......Smart Cart Device id box is clicked Successfully....");
System.out.println(" ");
System.out.println("....Checking whther the Device name box field is empty or not.....");
System.out.println(" ");
if( click_name_box!=null)
{
click_name_box.clear();
}
click_name_box.sendKeys(results.getField("SmartCartDeviceName"));
Thread.sleep(2000);
System.out.println(" Device Name is "+results.getField("SmartCartDeviceName"));
System.out.println(" ");
System.out.println("....Device name is sent successfully from the excel sheet.....");
System.out.println(" ");
//Click on Save button after sending values to the respective text boxes
System.out.println("...Click on Save button....");
WebElement save_btn=driver.findElement(By.xpath(rx.readdatafromexcel("sheet1",4,1)));
mod.click(save_btn);
Thread.sleep(2000);
System.out.println(" ");
System.out.println("......Save button is clicked successfully.....");
//Handle Confirmation Pop up
System.out.println(" ");
System.out.println(".....After click on save confimation window will appear....");
System.out.println(" ");
WebDriverWait wait=new WebDriverWait(driver,30);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(rx.readdatafromexcel("sheet1",5,1))));
System.out.println("....Wait for element to be clickable.....");
WebElement ok_pop=driver.findElement(By.xpath(rx.readdatafromexcel("sheet1", 5,1)));
mod.click(ok_pop);
Thread.sleep(2000);
System.out.println(" ");
System.out.println("....Successfully clicked on confirmation ok.....");
System.out.println(" ");
System.out.println(".....Successfully completed data retrievation from excel sheet.....");
System.out.println(" ");
}
}
}
readfromexcel is my function for reading data from excel. It contain xpath of all webelement.
java excel selenium-webdriver
marked as duplicate by Corey Goldberg, DebanjanB
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 5 at 10:27
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
So is your "Save button" in the same excel where you read the data from? If not than I don't see where you are adding data to the file? I can see you are pressing a "Save" button but not sure where that button is
– Zac
Jan 3 at 14:39
I have two excel sheet.One for storing all my web elements x-path and another one is foe test data.My save button is in my x-path sheet.
– pinki talukdar
Jan 4 at 5:56
add a comment |
This question already has an answer here:
selenium.common.exceptions.ElementNotVisibleException: Message: element not interactable using Selenium
1 answer
ElementNotVisibleException : Selenium Python
1 answer
selenium.common.exceptions.ElementNotVisibleException: Message: element not visible while trying to access an element with Python + Selenium
3 answers
I need help with my automation script.
First I need to click add button so it will open device id and device name text box. I am passing a value to that text box from excel sheet using filo and clicking on save. I am reading data from excel sheet. For any existing value, it will fetch data from excel sheet one by one. But if I enter new data in the sheet and try to fetch it will throw an error
element not visible
This is my script:
public void Click_Smart_Cart_Button() throws IOException, FilloException, InterruptedException
{
System.out.println(".....Click operation on Add_Smart_Cart_Device button......");
WebElement smart_cart_btn=driver.findElement(By.xpath(rx.readdatafromexcel("sheet1", 1,1)));
WebDriverWait wait2=new WebDriverWait(driver,15);
wait2.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(rx.readdatafromexcel("sheet1",1,1))));
mod.click(smart_cart_btn);
System.out.println(" ");
System.out.println("....Button is clicked Successfully....");
System.out.println(" ");
// Operation to Retrieve data from the Excel Sheet "TestData"
Fillo fillo= new Fillo();
Connection con=fillo.getConnection(Filepath);
String query = "Select SmartCartDeviceID, SmartCartDeviceName from Sheet1";//the parameters name and column name in excel sheet must be same.Eg "username"
Recordset results= con.executeQuery(query);
while(results.next()){
//Click on Device id text box and send data from sheet
System.out.println("....Click operation on Smart Card Device id text box....... ");
System.out.println(" ");
WebElement click_id_box=driver.findElement(By.xpath(rx.readdatafromexcel("sheet1", 2,1)));
if(click_id_box.isDisplayed()==false)
{
driver.manage().timeouts().implicitlyWait(6, TimeUnit.SECONDS);
mod.click(smart_cart_btn);
}
mod.click(click_id_box);
System.out.println("......Smart card device id box is clicked Sucessfully.....");
System.out.println(" ");
System.out.println("....Checking whther the id box field is empty or not...");
System.out.println(" ");
if(click_id_box != null)
{
click_id_box.clear();
}
click_id_box.sendKeys(results.getField("SmartCartDeviceID"));
Thread.sleep(1000);
System.out.print("Device id is "+results.getField("SmartCartDeviceID") +" ");
System.out.println(" ");
System.out.println("......Device id is sent succefully from the excel sheet.....");
System.out.println(" ");
//Click on Device name text box and send data from the sheet
System.out.println(".....Click operation on Smart Card Device Name Text Box...");
System.out.println(" ");
WebElement click_name_box=driver.findElement(By.xpath(rx.readdatafromexcel("sheet1", 3,1)));
mod.click(click_name_box);
System.out.println("......Smart Cart Device id box is clicked Successfully....");
System.out.println(" ");
System.out.println("....Checking whther the Device name box field is empty or not.....");
System.out.println(" ");
if( click_name_box!=null)
{
click_name_box.clear();
}
click_name_box.sendKeys(results.getField("SmartCartDeviceName"));
Thread.sleep(2000);
System.out.println(" Device Name is "+results.getField("SmartCartDeviceName"));
System.out.println(" ");
System.out.println("....Device name is sent successfully from the excel sheet.....");
System.out.println(" ");
//Click on Save button after sending values to the respective text boxes
System.out.println("...Click on Save button....");
WebElement save_btn=driver.findElement(By.xpath(rx.readdatafromexcel("sheet1",4,1)));
mod.click(save_btn);
Thread.sleep(2000);
System.out.println(" ");
System.out.println("......Save button is clicked successfully.....");
//Handle Confirmation Pop up
System.out.println(" ");
System.out.println(".....After click on save confimation window will appear....");
System.out.println(" ");
WebDriverWait wait=new WebDriverWait(driver,30);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(rx.readdatafromexcel("sheet1",5,1))));
System.out.println("....Wait for element to be clickable.....");
WebElement ok_pop=driver.findElement(By.xpath(rx.readdatafromexcel("sheet1", 5,1)));
mod.click(ok_pop);
Thread.sleep(2000);
System.out.println(" ");
System.out.println("....Successfully clicked on confirmation ok.....");
System.out.println(" ");
System.out.println(".....Successfully completed data retrievation from excel sheet.....");
System.out.println(" ");
}
}
}
readfromexcel is my function for reading data from excel. It contain xpath of all webelement.
java excel selenium-webdriver
This question already has an answer here:
selenium.common.exceptions.ElementNotVisibleException: Message: element not interactable using Selenium
1 answer
ElementNotVisibleException : Selenium Python
1 answer
selenium.common.exceptions.ElementNotVisibleException: Message: element not visible while trying to access an element with Python + Selenium
3 answers
I need help with my automation script.
First I need to click add button so it will open device id and device name text box. I am passing a value to that text box from excel sheet using filo and clicking on save. I am reading data from excel sheet. For any existing value, it will fetch data from excel sheet one by one. But if I enter new data in the sheet and try to fetch it will throw an error
element not visible
This is my script:
public void Click_Smart_Cart_Button() throws IOException, FilloException, InterruptedException
{
System.out.println(".....Click operation on Add_Smart_Cart_Device button......");
WebElement smart_cart_btn=driver.findElement(By.xpath(rx.readdatafromexcel("sheet1", 1,1)));
WebDriverWait wait2=new WebDriverWait(driver,15);
wait2.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(rx.readdatafromexcel("sheet1",1,1))));
mod.click(smart_cart_btn);
System.out.println(" ");
System.out.println("....Button is clicked Successfully....");
System.out.println(" ");
// Operation to Retrieve data from the Excel Sheet "TestData"
Fillo fillo= new Fillo();
Connection con=fillo.getConnection(Filepath);
String query = "Select SmartCartDeviceID, SmartCartDeviceName from Sheet1";//the parameters name and column name in excel sheet must be same.Eg "username"
Recordset results= con.executeQuery(query);
while(results.next()){
//Click on Device id text box and send data from sheet
System.out.println("....Click operation on Smart Card Device id text box....... ");
System.out.println(" ");
WebElement click_id_box=driver.findElement(By.xpath(rx.readdatafromexcel("sheet1", 2,1)));
if(click_id_box.isDisplayed()==false)
{
driver.manage().timeouts().implicitlyWait(6, TimeUnit.SECONDS);
mod.click(smart_cart_btn);
}
mod.click(click_id_box);
System.out.println("......Smart card device id box is clicked Sucessfully.....");
System.out.println(" ");
System.out.println("....Checking whther the id box field is empty or not...");
System.out.println(" ");
if(click_id_box != null)
{
click_id_box.clear();
}
click_id_box.sendKeys(results.getField("SmartCartDeviceID"));
Thread.sleep(1000);
System.out.print("Device id is "+results.getField("SmartCartDeviceID") +" ");
System.out.println(" ");
System.out.println("......Device id is sent succefully from the excel sheet.....");
System.out.println(" ");
//Click on Device name text box and send data from the sheet
System.out.println(".....Click operation on Smart Card Device Name Text Box...");
System.out.println(" ");
WebElement click_name_box=driver.findElement(By.xpath(rx.readdatafromexcel("sheet1", 3,1)));
mod.click(click_name_box);
System.out.println("......Smart Cart Device id box is clicked Successfully....");
System.out.println(" ");
System.out.println("....Checking whther the Device name box field is empty or not.....");
System.out.println(" ");
if( click_name_box!=null)
{
click_name_box.clear();
}
click_name_box.sendKeys(results.getField("SmartCartDeviceName"));
Thread.sleep(2000);
System.out.println(" Device Name is "+results.getField("SmartCartDeviceName"));
System.out.println(" ");
System.out.println("....Device name is sent successfully from the excel sheet.....");
System.out.println(" ");
//Click on Save button after sending values to the respective text boxes
System.out.println("...Click on Save button....");
WebElement save_btn=driver.findElement(By.xpath(rx.readdatafromexcel("sheet1",4,1)));
mod.click(save_btn);
Thread.sleep(2000);
System.out.println(" ");
System.out.println("......Save button is clicked successfully.....");
//Handle Confirmation Pop up
System.out.println(" ");
System.out.println(".....After click on save confimation window will appear....");
System.out.println(" ");
WebDriverWait wait=new WebDriverWait(driver,30);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(rx.readdatafromexcel("sheet1",5,1))));
System.out.println("....Wait for element to be clickable.....");
WebElement ok_pop=driver.findElement(By.xpath(rx.readdatafromexcel("sheet1", 5,1)));
mod.click(ok_pop);
Thread.sleep(2000);
System.out.println(" ");
System.out.println("....Successfully clicked on confirmation ok.....");
System.out.println(" ");
System.out.println(".....Successfully completed data retrievation from excel sheet.....");
System.out.println(" ");
}
}
}
readfromexcel is my function for reading data from excel. It contain xpath of all webelement.
This question already has an answer here:
selenium.common.exceptions.ElementNotVisibleException: Message: element not interactable using Selenium
1 answer
ElementNotVisibleException : Selenium Python
1 answer
selenium.common.exceptions.ElementNotVisibleException: Message: element not visible while trying to access an element with Python + Selenium
3 answers
java excel selenium-webdriver
java excel selenium-webdriver
edited Jan 3 at 17:57


James Z
11.2k71936
11.2k71936
asked Jan 3 at 13:05
pinki talukdarpinki talukdar
225
225
marked as duplicate by Corey Goldberg, DebanjanB
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 5 at 10:27
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Corey Goldberg, DebanjanB
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 5 at 10:27
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
So is your "Save button" in the same excel where you read the data from? If not than I don't see where you are adding data to the file? I can see you are pressing a "Save" button but not sure where that button is
– Zac
Jan 3 at 14:39
I have two excel sheet.One for storing all my web elements x-path and another one is foe test data.My save button is in my x-path sheet.
– pinki talukdar
Jan 4 at 5:56
add a comment |
So is your "Save button" in the same excel where you read the data from? If not than I don't see where you are adding data to the file? I can see you are pressing a "Save" button but not sure where that button is
– Zac
Jan 3 at 14:39
I have two excel sheet.One for storing all my web elements x-path and another one is foe test data.My save button is in my x-path sheet.
– pinki talukdar
Jan 4 at 5:56
So is your "Save button" in the same excel where you read the data from? If not than I don't see where you are adding data to the file? I can see you are pressing a "Save" button but not sure where that button is
– Zac
Jan 3 at 14:39
So is your "Save button" in the same excel where you read the data from? If not than I don't see where you are adding data to the file? I can see you are pressing a "Save" button but not sure where that button is
– Zac
Jan 3 at 14:39
I have two excel sheet.One for storing all my web elements x-path and another one is foe test data.My save button is in my x-path sheet.
– pinki talukdar
Jan 4 at 5:56
I have two excel sheet.One for storing all my web elements x-path and another one is foe test data.My save button is in my x-path sheet.
– pinki talukdar
Jan 4 at 5:56
add a comment |
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
So is your "Save button" in the same excel where you read the data from? If not than I don't see where you are adding data to the file? I can see you are pressing a "Save" button but not sure where that button is
– Zac
Jan 3 at 14:39
I have two excel sheet.One for storing all my web elements x-path and another one is foe test data.My save button is in my x-path sheet.
– pinki talukdar
Jan 4 at 5:56