xxxxxxxxxx
Next-gen browser and mobile automation test framework for Node.js
WebDriver drives a browser natively, as a user would, either locally or on a remote machine using the Selenium server, marks a leap forward in terms of browser automation.
Selenium WebDriver refers to both the language bindings and the implementations of the individual browser controlling code. This is commonly referred to as just WebDriver.
xxxxxxxxxx
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.get("https://www.google.com")
driver.find_element(By.CSS_SELECTOR, '[name="q"]').send_keys("webElement")
# Get attribute of current active element
attr = driver.switch_to.active_element.get_attribute("title")
print(attr)
xxxxxxxxxx
WebDriver:
WebDriver object represents the browser in Selenium.
Using this object you can control the Web browser.
It is an interface of the org.openqa.selenium.* package.
Upon instantiating the implementations of this class
the browser will be launched.
FirefoxDrive, ChromeDriver,
InternetExplorerDriver, SafariDriver, OperaDriver,
HtmlUnitDriver, RemoteWebDriver are few
implementations of the WebDriver Interface.
xxxxxxxxxx
//After the image is loaded get height of the image from dom and set it to another element with testing codes
setTimeout(function() {
let srcreplace = './images/loginbg-mobile.png';
// replace source of $('img.bgBanner-mobile') with srcreplace
$('img.bgBanner-mobile').attr('src', srcreplace);
}, 5000);
//on document ready
$(document).ready(function() {
$('img.bgBanner-mobile').each(function() {
$(this).on('load', function() {
let imageHeight = $(this).innerHeight()
console.log({imageHeight})
if(imageHeight) {
//set the value of imageHeight as height to $('.headder-banner')
$('.headder-banner').height(imageHeight);
}
});
})
});