How to block/close a notification (e.g facebook notification)

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

How to block/close a notification (e.g facebook notification)

tayootegbayo
I ran a selenium script on facebook site, but I keep getting a notification after the login. Please, how can i write a script to close/block it

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/82504357-4c83-4b83-803c-21ed5868ad7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to block/close a notification (e.g facebook notification)

Shiva Prasad Adirala
Those are managed used chrome Options - Browser specific

Please Follow below steps :

Step 1:

//Create a instance of ChromeOptions class
  ChromeOptions options = new ChromeOptions();

Step 2:

//Add chrome switch to disable notification - "--disable-notifications"
  options.addArguments("--disable-notifications");

Step 3:

//Pass ChromeOptions instance to ChromeDriver Constructor
  WebDriver driver =new ChromeDriver(options);

Ready made answer for your query here

On Fri, Jun 1, 2018 at 3:27 PM, <[hidden email]> wrote:
I ran a selenium script on facebook site, but I keep getting a notification after the login. Please, how can i write a script to close/block it

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/82504357-4c83-4b83-803c-21ed5868ad7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Thank You,
A Shiva Prasad
M: 7337081318

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAJedVKXTCVzHpmnNDaXgukHmtsxDJvh%3DXyUmQpC4CEQw-bFwMA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to block/close a notification (e.g facebook notification)

Shiva Prasad Adirala
In reply to this post by tayootegbayo
Those are managed used chrome Options - Browser specific

Please Follow below steps :

Step 1:

//Create a instance of ChromeOptions class
  ChromeOptions options = new ChromeOptions();

Step 2:

//Add chrome switch to disable notification - "--disable-notifications"
  options.addArguments("--disable-notifications");

Step 3:

//Pass ChromeOptions instance to ChromeDriver Constructor
  WebDriver driver =new ChromeDriver(options);

Ready made answer for your query here

On Friday, June 1, 2018 at 5:06:12 PM UTC+5:30, [hidden email] wrote:
I ran a selenium script on facebook site, but I keep getting a notification after the login. Please, how can i write a script to close/block it

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/f9e03410-d48d-42a8-9195-6ea854d50874%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to block/close a notification (e.g facebook notification)

tayootegbayo
Thanks Shiva,

Please what should I put in the step 2, I mean '--disable notification'. Because I ran the script again and I am still getting the notification.

Find me script below

public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-notifications");
   
WebDriver driver;
System.setProperty("webdriver.chrome.driver", "C:/Users/User/Downloads/Selenium/chromedriver.exe");
driver = new ChromeDriver ();
driver.manage().window().maximize();

File src = new File ("C:\\Users\\User\\Desktop\\facebook.xlsx");
FileInputStream fis = new FileInputStream (src); 
XSSFWorkbook wb = new XSSFWorkbook (fis);
XSSFSheet sheet1 = wb.getSheetAt(0);
int rowcount = sheet1.getLastRowNum();

for (int i=1; i<rowcount +1; i++) 
{
String data0 =  sheet1.getRow(i).getCell(0).getStringCellValue();
driver.findElement(By.xpath("html/body/div[1]/div[2]/div/div/div/div/div[2]/form/table/tbody/tr[2]/td[1]/input")).sendKeys(data0);
System.out.println("The cells value are "+ data0);
String data1=  sheet1.getRow(i).getCell(1).getStringCellValue();
driver.findElement(By.xpath("html/body/div[1]/div[2]/div/div/div/div/div[2]/form/table/tbody/tr[2]/td[2]/input")).sendKeys(data1);
System.out.println("The cells value are "+ data1);
driver.findElement(By.xpath("html/body/div[1]/div[2]/div/div/div/div/div[2]/form/table/tbody/tr[2]/td[3]/label/input")).click();
Thread.sleep(10000);
driver.findElement(By.xpath("html/body/div[1]/div[2]/div/div[1]/div/div/div/div[2]/div[3]/div[2]/div/div/a/div")).click();
Thread.sleep(20000);


//Confirm Visitor Page

String actual_facebooktitle = driver.getTitle();

System.out.println("The title is "+ actual_facebooktitle);

String expected_facebooktitle = "Facebook";
Assert.assertEquals(actual_facebooktitle, expected_facebooktitle);
  
driver.findElement(By.xpath("html/body/div[20]/div/div/div/div/div[1]/div/div/ul/li[16]/a/span/span")).click();
}
fis.close();


On Fri, Jun 1, 2018 at 12:48 PM, Shiva Prasad Adirala <[hidden email]> wrote:
Those are managed used chrome Options - Browser specific

Please Follow below steps :

Step 1:

//Create a instance of ChromeOptions class
  ChromeOptions options = new ChromeOptions();

Step 2:

//Add chrome switch to disable notification - "--disable-notifications"
  options.addArguments("--disable-notifications");

Step 3:

//Pass ChromeOptions instance to ChromeDriver Constructor
  WebDriver driver =new ChromeDriver(options);

Ready made answer for your query here

On Friday, June 1, 2018 at 5:06:12 PM UTC+5:30, [hidden email] wrote:
I ran a selenium script on facebook site, but I keep getting a notification after the login. Please, how can i write a script to close/block it

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/f9e03410-d48d-42a8-9195-6ea854d50874%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CA%2BrQJF0B19ZTPZZmZ3BFcj4cScbrYeAMx4atF98t5CRHijfw%2Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to block/close a notification (e.g facebook notification)

Shiva Prasad Adirala
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-notifications");
System.setProperty("webdriver.chrome.driver", "C:/Users/User/Downloads/Selenium/chromedriver.exe");
driver = new ChromeDriver (options);
driver.manage().window().maximize();


On Friday, June 1, 2018 at 7:14:33 PM UTC+5:30, otegbayo tayo wrote:
Thanks Shiva,

Please what should I put in the step 2, I mean '--disable notification'. Because I ran the script again and I am still getting the notification.

Find me script below

public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-notifications");
   
WebDriver driver;
System.setProperty("webdriver.chrome.driver", "C:/Users/User/Downloads/Selenium/chromedriver.exe");
driver = new ChromeDriver ();
driver.get("<a href="https://www.facebook.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.facebook.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE5Ef-E4HXdfc65KBcWNaLYjh9t4w&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.facebook.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE5Ef-E4HXdfc65KBcWNaLYjh9t4w&#39;;return true;">https://www.facebook.com/");
driver.manage().window().maximize();

File src = new File ("C:\\Users\\User\\Desktop\\facebook.xlsx");
FileInputStream fis = new FileInputStream (src); 
XSSFWorkbook wb = new XSSFWorkbook (fis);
XSSFSheet sheet1 = wb.getSheetAt(0);
int rowcount = sheet1.getLastRowNum();

for (int i=1; i<rowcount +1; i++) 
{
String data0 =  sheet1.getRow(i).getCell(0).getStringCellValue();
driver.findElement(By.xpath("html/body/div[1]/div[2]/div/div/div/div/div[2]/form/table/tbody/tr[2]/td[1]/input")).sendKeys(data0);
System.out.println("The cells value are "+ data0);
String data1=  sheet1.getRow(i).getCell(1).getStringCellValue();
driver.findElement(By.xpath("html/body/div[1]/div[2]/div/div/div/div/div[2]/form/table/tbody/tr[2]/td[2]/input")).sendKeys(data1);
System.out.println("The cells value are "+ data1);
driver.findElement(By.xpath("html/body/div[1]/div[2]/div/div/div/div/div[2]/form/table/tbody/tr[2]/td[3]/label/input")).click();
Thread.sleep(10000);
driver.findElement(By.xpath("html/body/div[1]/div[2]/div/div[1]/div/div/div/div[2]/div[3]/div[2]/div/div/a/div")).click();
Thread.sleep(20000);


//Confirm Visitor Page

String actual_facebooktitle = driver.getTitle();

System.out.println("The title is "+ actual_facebooktitle);

String expected_facebooktitle = "Facebook";
Assert.assertEquals(actual_facebooktitle, expected_facebooktitle);
  
driver.findElement(By.xpath("html/body/div[20]/div/div/div/div/div[1]/div/div/ul/li[16]/a/span/span")).click();
}
fis.close();


On Fri, Jun 1, 2018 at 12:48 PM, Shiva Prasad Adirala <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="rAQCINh_AAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">adiral...@...> wrote:
Those are managed used chrome Options - Browser specific

Please Follow below steps :

Step 1:

//Create a instance of ChromeOptions class
  ChromeOptions options = new ChromeOptions();

Step 2:

//Add chrome switch to disable notification - "--disable-notifications"
  options.addArguments("--disable-notifications");

Step 3:

//Pass ChromeOptions instance to ChromeDriver Constructor
  WebDriver driver =new ChromeDriver(options);

Ready made answer for your query <a href="http://learn-automation.com/disable-chrome-notifications-selenium-webdriver/" style="color:rgb(17,85,204)" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flearn-automation.com%2Fdisable-chrome-notifications-selenium-webdriver%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHC1uw-xCWsqMzbLo4VknmpHWjeuw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flearn-automation.com%2Fdisable-chrome-notifications-selenium-webdriver%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHC1uw-xCWsqMzbLo4VknmpHWjeuw&#39;;return true;">here

On Friday, June 1, 2018 at 5:06:12 PM UTC+5:30, [hidden email] wrote:
I ran a selenium script on facebook site, but I keep getting a notification after the login. Please, how can i write a script to close/block it

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="rAQCINh_AAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">selenium-user...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="rAQCINh_AAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/f9e03410-d48d-42a8-9195-6ea854d50874%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/f9e03410-d48d-42a8-9195-6ea854d50874%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/f9e03410-d48d-42a8-9195-6ea854d50874%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/f9e03410-d48d-42a8-9195-6ea854d50874%40googlegroups.com.

For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/dcc777b0-5aed-48ac-97ff-c7e10a2c8c94%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to block/close a notification (e.g facebook notification)

tayootegbayo
Thanks so much for your effort.

Find my former code below, it is not different from what you've just sent

ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-notifications");
WebDriver driver;
System.setProperty("webdriver.chrome.driver", "C:/Users/User/Downloads/Selenium/chromedriver.exe");
driver = new ChromeDriver ();
driver.manage().window().maximize();

On Fri, Jun 1, 2018 at 2:55 PM, Shiva Prasad Adirala <[hidden email]> wrote:
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-notifications");
System.setProperty("webdriver.chrome.driver", "C:/Users/User/Downloads/Selenium/chromedriver.exe");
driver = new ChromeDriver (options);
driver.manage().window().maximize();


On Friday, June 1, 2018 at 7:14:33 PM UTC+5:30, otegbayo tayo wrote:
Thanks Shiva,

Please what should I put in the step 2, I mean '--disable notification'. Because I ran the script again and I am still getting the notification.

Find me script below

public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-notifications");
   
WebDriver driver;
System.setProperty("webdriver.chrome.driver", "C:/Users/User/Downloads/Selenium/chromedriver.exe");
driver = new ChromeDriver ();
driver.manage().window().maximize();

File src = new File ("C:\\Users\\User\\Desktop\\facebook.xlsx");
FileInputStream fis = new FileInputStream (src); 
XSSFWorkbook wb = new XSSFWorkbook (fis);
XSSFSheet sheet1 = wb.getSheetAt(0);
int rowcount = sheet1.getLastRowNum();

for (int i=1; i<rowcount +1; i++) 
{
String data0 =  sheet1.getRow(i).getCell(0).getStringCellValue();
driver.findElement(By.xpath("html/body/div[1]/div[2]/div/div/div/div/div[2]/form/table/tbody/tr[2]/td[1]/input")).sendKeys(data0);
System.out.println("The cells value are "+ data0);
String data1=  sheet1.getRow(i).getCell(1).getStringCellValue();
driver.findElement(By.xpath("html/body/div[1]/div[2]/div/div/div/div/div[2]/form/table/tbody/tr[2]/td[2]/input")).sendKeys(data1);
System.out.println("The cells value are "+ data1);
driver.findElement(By.xpath("html/body/div[1]/div[2]/div/div/div/div/div[2]/form/table/tbody/tr[2]/td[3]/label/input")).click();
Thread.sleep(10000);
driver.findElement(By.xpath("html/body/div[1]/div[2]/div/div[1]/div/div/div/div[2]/div[3]/div[2]/div/div/a/div")).click();
Thread.sleep(20000);


//Confirm Visitor Page

String actual_facebooktitle = driver.getTitle();

System.out.println("The title is "+ actual_facebooktitle);

String expected_facebooktitle = "Facebook";
Assert.assertEquals(actual_facebooktitle, expected_facebooktitle);
  
driver.findElement(By.xpath("html/body/div[20]/div/div/div/div/div[1]/div/div/ul/li[16]/a/span/span")).click();
}
fis.close();


On Fri, Jun 1, 2018 at 12:48 PM, Shiva Prasad Adirala <[hidden email]> wrote:
Those are managed used chrome Options - Browser specific

Please Follow below steps :

Step 1:

//Create a instance of ChromeOptions class
  ChromeOptions options = new ChromeOptions();

Step 2:

//Add chrome switch to disable notification - "--disable-notifications"
  options.addArguments("--disable-notifications");

Step 3:

//Pass ChromeOptions instance to ChromeDriver Constructor
  WebDriver driver =new ChromeDriver(options);

Ready made answer for your query here

On Friday, June 1, 2018 at 5:06:12 PM UTC+5:30, [hidden email] wrote:
I ran a selenium script on facebook site, but I keep getting a notification after the login. Please, how can i write a script to close/block it

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/f9e03410-d48d-42a8-9195-6ea854d50874%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/dcc777b0-5aed-48ac-97ff-c7e10a2c8c94%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CA%2BrQJF06Pw2uyD%3DWe26TyZKMSJo6WFpgGnGpj6vNEq7Fhfkaig%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to block/close a notification (e.g facebook notification)

Shiva Prasad Adirala
Please consider the change. You has to include 'options' while creating browser.

driver = new chromeDriver(options).

Please go through this URL for ur query ready made answer
http://learn-automation.com/disable-chrome-notifications-selenium-webdriver/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/4155b74a-c96c-4fd1-940b-bdb3e453adaf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to block/close a notification (e.g facebook notification)

tayootegbayo
I am really grateful.

It worked.

On Fri, Jun 1, 2018 at 5:10 PM, Shiva Prasad Adirala <[hidden email]> wrote:
Please consider the change. You has to include 'options' while creating browser.

driver = new chromeDriver(options).

Please go through this URL for ur query ready made answer
http://learn-automation.com/disable-chrome-notifications-selenium-webdriver/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/4155b74a-c96c-4fd1-940b-bdb3e453adaf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CA%2BrQJF2ggNcvssEyf6NVeEJ2S%2BiCfzsKLX8%3DdeoQb9HFVZuufg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.