We can run Chrome browser Incognito mode with Selenium webdriver. Incognito mode is a safe mode of opening a browser. This can be done with the help of the DesiredCapabilities and ChromeOptions class.We shall create an object of the ChromeOptions class and apply addArguments method on it. Then pass −−incognito as a parameter to that method. We shall then create an object of the DesiredCapabilities class.We shall apply setCapability method on the object of the DesiredCapabilities class and pass the ChromeOptions.CAPABILITY and the object of ChromeOptions class as parameters to that method.Finally, this browser chrome profile shall be fed to ... Read More
We can deal with security certificates using Selenium webdriver. We can have certificates like the SSL certificate and insecure certificate. All these can be handled with the help of the DesiredCapabilities and ChromeOptions class.We shall create an object of the DesiredCapabilities class and apply setCapability method on it. Then pass the CapabilityType and value as parameters to that method.These general browser chrome profiles shall be fed to the object of the ChromeOptions class for the local browser with the help of the merge method. Finally, this information needs to be passed to the webdriver object.SyntaxDesiredCapabilities c=DesiredCapabilities.chrome(); c.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true); c.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); ... Read More
Selenium RC is a key part in Selenium. It is a framework for testing that allows testers and developers to design test scripts in multiple languages to automate frontend UI test cases.It has a client library and a server that starts and quits the browser sessions by default.Selenium RC is deprecated because of the reasons listed below −Selenium RC comprises an additional layer of JavaScript known as the core which makes it slower.Selenium RC has complicated and redundant APIs.Selenium RC is not compatible with the HTMLUnit browser (required for headless execution).Selenium RC has in-built HTML report generation features for test ... Read More
Creating a table in PostgreSQL is pretty straightforward. The syntax is −CREATE TABLE table_name( Column1_name type optional_constraint, Column2_name type optional_constraint, . . . ColumnN_name type optional constraint );If you want to make sure that your table is created only if it doesn’t already exist, you can specify that explicitly −CREATE TABLE IF NOT EXISTS table_name(…);An example of table creation is given below −CREATE TABLE marks( serial_no SERIAL PRIMARY KEY, name VARCHAR, roll_no INTEGER, marks_obtained INTEGER, perc_marks DOUBLE PRECISION, max_marks INTEGER, date_of_entry DATE );The above command will just ... Read More
We can get HTML with JavaScript rendered source code by using Selenium webdriver. Selenium can execute JavaScript commands with the help of the executeScript method.JavaScript command to be executed is passed as a parameter to the method. To obtain the HTML, with JavaScript, we shall pass return document.getElementsByTagName('html')[0].innerHTML as a parameter to the executeScript method.SyntaxJavascriptExecutor j = (JavascriptExecutor) driver; String s = (String) j.executeScript (return document.getElementsByTagName('html')[0].innerHTML");Exampleimport org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebElement; import org.openqa.selenium.By; public class HTmlSrcJS{ public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver = new ... Read More
We can send keys without specifying elements in Python with Selenium webdriver. The tagname input is used for all the edit boxes. We shall use the find_element_by_tag_name method and pass input as a parameter to that method.Thus we need not mention element attributes explicitly. Let us investigate the html code of an element which can be identified with tagname input.Examplefrom selenium import webdriver #set geckodriver.exe path driver = webdriver.Firefox(executable_path="C:\geckodriver.exe") driver.implicitly_wait(0.5) driver.get("https://www.tutorialspoint.com/index.htm") #identify element with tagname l = driver.find_element_by_tag_name("input") l.send_keys("Selenium") #obtain value obtained print("Value entered: ") print(l.get_attribute('value')) driver.quit()OutputRead More
We can use extensions with Selenium webdriver in Python. We can have multiple extensions of the Chrome browser while we manually open the browser and work on it.However, while the Chrome browser is opened through Selenium webdriver, those extensions which are available to the local browser will not be present. To configure an extension, we have to obtain the .crx extension file of the extension.Then we have to perform installation of the extension to the browser which is launched by Selenium. To get all the extensions available to the browser enter chrome://extensions on the browser address bar.To get add an ... Read More
Sometimes, some rogue queries can take too long to execute. If the queries are blocking in nature, i.e., they restrict access to a table while they are executing, then any other query on the same table will be put on hold, and this leads to a pile-up of queries. This can, depending on your DB load, even cause the max connections to be exceeded. Luckily, you can easily kill long queries in pgAdmin.Go to Dashboard in your pgAdmin. At the bottom, in the Server Activity section, under the Sessions Tab, you can see all the Active queries.Now, notice the cross ... Read More
Querying a DB in pgAdmin is quite straightforward. Locate your DB in the Servers dropdown on the left, and extend its dropdown, till you see the Schemas dropdown.Once you click on Schemas, the black button on the top, with the DB symbol and the play arrow will become clickable.Click on that button, and you will see a Query Tab open up. That’s it, you can type your queries for this particular DB in that box, and click the play arrow button to execute the queries.The output will be seen on the bottom, in the ‘Data Output’ section.Read More
We can send a DELETE keystroke to a text field using Selenium webdriver with Python. First of all, we have to identify the text field with the help of any locators like xpath, css, id, and so on.We can enter a text in the text field with the send_keys method. The value to be entered is passed as parameter to the method. To delete a key, we can pass Keys.BACKSPACE as a parameter to the send_keys method.Syntaxl = driver.find_element_by_id("gsc−i−id1") l.send_keys("Sel") l.send_keys(Keys.BACKSPACE)To delete all the keys entered simultaneously, we have to pass CTRL+A and BACKSPACE as parameters to the send_keys method.Syntaxl ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP