Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

extract data using selenium and disable javascript

package DemoAutomation;
 
import java.util.HashMap;
import java.util.Map;
 
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
 
public class JSdisableChrome {
 
           //Disabling JS in Chrome
          @Test()
    public void Chrome_javascript_disable() throws InterruptedException {
        
        System.setProperty("webdriver.chrome.driver", "C:UsersLenovo-I7DesktopSeleniumchromedriver.exe");
        
        ChromeOptions options = new ChromeOptions();
        Map<String, Object> prefs = new HashMap<String, Object>();
        prefs.put("profile.managed_default_content_settings.javascript", 2);
        options.setExperimentalOption("prefs", prefs);
        
        
        WebDriver driver = new ChromeDriver(options);
        
        driver.get("https://www.google.com/imghp");
        driver.findElement(By.name("q")).sendKeys("flowers");
        driver.findElement(By.className("Tg7LZd")).click();
        Thread.sleep(5000);
        
        
        driver.quit();  
        
        
    }
    
    
 
}
Comment

PREVIOUS NEXT
Code Example
Python :: ternary operator in list comprehension python 
Python :: groupby and add aggregated column 
Python :: kaggle set utility script 
Python :: python program to remove duplicate images from folder 
Python :: pyqt serial plotter 
Python :: python if corto 
Python :: if no python 
Python :: how to show type of a variable 
Python :: sklearn encoding pipelin 
Python :: Python beginner question - trying to understand return statement 
Python :: cours python 
Python :: how to import grades into a text file in python 
Python :: ax pie rounding 
Python :: random pick and remove index pandas 
Python :: ring raise an exception 
Python :: ring get a list of functions names written in the Ring language 
Python :: check string on substring godot 
Python :: All objects and constants needed to use the ldap3 library can be imported from the ldap3 namespace 
Python :: python you can think pad baldi 
Python :: python message from byte 
Python :: pandas count zeros in column 
Python :: dbscan multidimensional data 
Python :: long type python 
Python :: cant import flask mail 
Python :: pattern program in python A aB bCc DdEe 
Python :: macos youtube-dl unable to get local issuer certificate _ssl.c:1131 
Python :: what modules are used for NLG in python 
Python :: Python[17586:513448] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to 
Python :: pandas crosstab function(counting) frequencies 
Python :: deploy vue app to google cloud run 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =