How to add Proxy Capability for Create Webdriver in RobotFramework - selenium-chromedriver

I am using ROBOT framework and need to create a webdriver with proxy capabilities to access a website sharklasers.com in headless mode which has firewall to access in CMD or in headless mode, but its not working, I tried with various options..but its not working.
Note:I could find some options in Java, but not in robot Framework
I tried with --proxy-server, http_proxy argument..both are not working
${options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
log ${options}
Call Method ${options} add_argument headless
Call Method ${options} add_experimental_option useAutomationExtension ${FALSE}
Call Method ${options} add_argument headless
Call Method ${options} add_argument disable-gpu
Call Method ${options} add_argument --disable-extensions
Call Method ${options} add_argument --no-sandbox
Call Method ${options} add_argument --proxy-server=bcppx-el01-int.uhc.com:8080
Create Webdriver Chrome executable_path=${CURDIR}/../../Drivers/chromedriver.exe chrome_options=${options}
$I tried below Code also which is not working
${args}= Create List --proxy-server=bcprx-elr01-int.uhc.com:8080
${chrome_proxyoptions}= Create Dictionary args=${args}
Create WebDriver Chrome executable_path=${CURDIR}/../../Drivers/chromedriver.exe chrome_options= ${chrome_proxyoptions}
Expected:Browser should Open
Actual Result for code block1 :
20191021 21:35:30.389 : INFO : ${options} = <selenium.webdriver.chrome.options.Options object at 0x0000000017B0A240>
20191021 21:35:30.404 : FAIL : Calling method 'add_argument' failed: TypeError: add_argument() got an unexpected keyword argument '--proxy-server'
Actual Result for code block2:
20191021 21:39:26.073 : INFO : Sharktest
20191021 21:39:26.077 : INFO : ${args} = [u'--proxy-server=bcprx-elr01-int.uhc.com:8080']
20191021 21:39:26.079 : INFO : ${chrome_proxyoptions} = {u'args': [u'--proxy-server=bcprx-elr01-int.uhc.com:8080']}
20191021 21:39:26.082 : INFO : Creating an instance of the Chrome WebDriver.
20191021 21:39:26.084 : INFO : Cannot capture screenshot because no browser is open.
20191021 21:39:26.089 : FAIL : AttributeError: 'unicode' object has no attribute 'to_capabilities'

Related

Method not found: '!!0 System.Text.Json.JsonSerializer.Deserialize(System.ReadOnlySpan`1<Byte>, System.Text.Json.JsonSerializerOptions)'

Just tried to create a new web api .net 6.0 and on first build/run getting error:
1>obj\Debug\net6.0\staticwebassets.build.json : error : MissingMethodException: Method not found: '!!0 System.Text.Json.JsonSerializer.Deserialize(System.ReadOnlySpan`1, System.Text.Json.JsonSerializerOptions)'.
Any Idea?!

Android-JUnit5 No instrumentation registered! when getting context

I know this is "common" error but I am trying to make a JUnit5 Android Room test working.
I found out that JUnit5 does not support the instrumentation test (or google does not support JUnit 5 I should say) but I discovered that https://github.com/mannodermaus/android-junit5 is supposed to help me.
I modified my graddle to have the plugin added in my module and the classpath at the top of the project.
classpath("de.mannodermaus.gradle.plugins:android-junit5:1.7.1.1")
id("kotlin-android")
I also added the specific dependencies from it
androidTestImplementation("de.mannodermaus.junit5:android-test-core:1.2.2")
androidTestRuntimeOnly("de.mannodermaus.junit5:android-test-runner:1.2.2")
And in the android defaultConfig of my module I added
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArgument("runnerBuilder", "de.mannodermaus.junit5.AndroidJUnit5Builder")
The graddle builds fine but the issue is when I run my simple test
class DbTest
{
private lateinit var myDao : MyDao
#BeforeEach
fun init()
{
val context : Context = ApplicationProvider.getApplicationContext();
val db = Room.inMemoryDatabaseBuilder(
context,
ConfigDatabase::class.java).build()
tcdDao = db.getMyDao()
}
[...]
}
The error occurs when I get the context :
No instrumentation registered! Must run under a registering instrumentation.
I want to specify that I cannot use JUnit4.
Am I missing something ? Can I actually test my database with JUnit5 ? Or should I use another solution ?

Running website on app in xcode and getting error "Thread 1: signal SIGABRT"

I'm setting up an app with my website and I was getting no errors until i run the app and get the next one: "Thread 1: signal SIGABRT".
import UIKit
#UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
// this is where i am getting the error "Thread 1: signal SIGABRT"
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
//error i get when running is *** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named WKWebView because no class named WKWebView was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target)'
Open Project > Build Phases > Link Binary with Libraries
Click on + icon and add WebKit.framework.
Clean Project and Run will fix your issue.

How do I pass arguments to google chrome when running selenium?

I want to be able to pass arguments to google chrome when running selenium. How can I do that? When I run selenium I use the Java command Java -jar selenium.jar
How can I pass arguments such as no-sandbox, ignore-gpu-blacklist, enable-webgl to google chrome executable. Thanks
I'm using nightwatch
You can send them in your method for launching the driver. e.g.
public static WebDriver chromeBrowser() throws Throwable {
System.setProperty("webdriver.chrome.driver", "C:\\chromedriver-location\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("--no-sandbox");
WebDriver browser = new ChromeDriver(options);
browser.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
return browser;
}
In nightwatch you should include chromeOptions with no-sandbox args into desiredCapabilities as below :-
"desiredCapabilities" : {
"browserName" : "chrome",
"javascriptEnabled" : true,
"acceptSslCerts" : true,
"chromeOptions" : {
"args" : ["--no-sandbox"]
}
}

Google Script Libraries Not Working

I'm assuming I'm skipping a step here, but I can't seem to figure out how to use libraries. Here are the steps.
Library:
Create New Project
-Name it "test"
-function myFunction() { return "HELLO"; }
-publish
-file->project properties->get project key
Main Program
-Add Library (Resources->Libraries->Add key->Name it test, Select Dev (for simplicity)
-Code: var mytest = test.myFunction();
Result:
In console, I get: Uncaught ReferenceError: test is not defined
The Library set up dialog looks like this:
Did you type 'test' into the Identifier field?