Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DesiredCapabilities, Local file detector using C# #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
diemol merged 8 commits into SeleniumHQ:master from hiroksarker:patch-7
Nov 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ driver.quit();
# We don't have a Python code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="csharp" >}}
// We don't have a C# code sample yet - Help us out and raise a PR
var chromeOptions = new ChromeOptions();
chromeOptions.BrowserVersion = "67";
chromeOptions.PlatformName = "Windows XP";
IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), chromeOptions);
driver.Navigate().GoToUrl("http://www.google.com");
driver.Quit();
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
caps = Selenium::WebDriver::Remote::Capabilities.chrome
Expand Down Expand Up @@ -113,7 +118,11 @@ driver.setFileDetector(new LocalFileDetector());
# We don't have a Python code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="csharp" >}}
// We don't have a C# code sample yet - Help us out and raise a PR
var allowsDetection = this.driver as IAllowsFileDetection;
if (allowsDetection != null)
{
allowsDetection.FileDetector = new LocalFileDetector();
}
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
@driver.file_detector = lambda do |args|
Expand Down Expand Up @@ -142,7 +151,9 @@ upload.sendKeys("/Users/sso/the/local/path/to/darkbulb.jpg");
# We don't have a Python code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="csharp" >}}
// We don't have a C# code sample yet - Help us out and raise a PR
driver.Navigate().GoToUrl("http://sso.dev.saucelabs.com/test/guinea-file-upload");
IWebElement upload = driver.FindElement(By.Id("myfile"));
upload.SendKeys(@"/Users/sso/the/local/path/to/darkbulb.jpg");
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
@driver.navigate.to "http://sso.dev.saucelabs.com/test/guinea-file-upload"
Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ English to Spanish. Do you speak Spanish? Help us to translate
it by sending us pull requests!
{{% /notice %}}

First, we need to connect to the RemoteWebDriver.
To run a remote WebDriver client, we first need to connect to the RemoteWebDriver.
We do this by pointing the URL to the address of the server running our tests.
In order to customize our configuration, we set desired capabilities.
Below is an example of instantiating a remote WebDriver object
Expand All @@ -31,7 +31,7 @@ driver.quit();
IWebDriver driver = new RemoteWebDriver(new Uri("http://www.example.com"), firefoxOptions);
driver.Navigate().GoToUrl("http://www.google.com");
driver.Quit();
{{< / code-panel >}}
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
require 'selenium-webdriver'

Expand Down Expand Up @@ -78,7 +78,12 @@ driver.quit();
# We don't have a Python code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="csharp" >}}
// We don't have a C# code sample yet - Help us out and raise a PR
var chromeOptions = new ChromeOptions();
chromeOptions.BrowserVersion = "67";
chromeOptions.PlatformName = "Windows XP";
IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), chromeOptions);
driver.Navigate().GoToUrl("http://www.google.com");
driver.Quit();
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
caps = Selenium::WebDriver::Remote::Capabilities.chrome
Expand Down Expand Up @@ -119,7 +124,11 @@ driver.setFileDetector(new LocalFileDetector());
# We don't have a Python code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="csharp" >}}
// We don't have a C# code sample yet - Help us out and raise a PR
var allowsDetection = this.driver as IAllowsFileDetection;
if (allowsDetection != null)
{
allowsDetection.FileDetector = new LocalFileDetector();
}
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
@driver.file_detector = lambda do |args|
Expand Down Expand Up @@ -148,7 +157,9 @@ upload.sendKeys("/Users/sso/the/local/path/to/darkbulb.jpg");
# We don't have a Python code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="csharp" >}}
// We don't have a C# code sample yet - Help us out and raise a PR
driver.Navigate().GoToUrl("http://sso.dev.saucelabs.com/test/guinea-file-upload");
IWebElement upload = driver.FindElement(By.Id("myfile"));
upload.SendKeys(@"/Users/sso/the/local/path/to/darkbulb.jpg");
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
@driver.navigate.to "http://sso.dev.saucelabs.com/test/guinea-file-upload"
Expand All @@ -164,4 +175,3 @@ val upload: WebElement = driver.findElement(By.id("myfile"))
upload.sendKeys("/Users/sso/the/local/path/to/darkbulb.jpg")
{{< / code-panel >}}
{{< / code-tab >}}

View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ English to French. Do you speak French? Help us to translate
it by sending us pull requests!
{{% /notice %}}

First, we need to connect to the RemoteWebDriver.
To run a remote WebDriver client, we first need to connect to the RemoteWebDriver.
We do this by pointing the URL to the address of the server running our tests.
In order to customize our configuration, we set desired capabilities.
Below is an example of instantiating a remote WebDriver object
Expand All @@ -31,7 +31,7 @@ driver.quit();
IWebDriver driver = new RemoteWebDriver(new Uri("http://www.example.com"), firefoxOptions);
driver.Navigate().GoToUrl("http://www.google.com");
driver.Quit();
{{< / code-panel >}}
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
require 'selenium-webdriver'

Expand Down Expand Up @@ -78,7 +78,12 @@ driver.quit();
# We don't have a Python code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="csharp" >}}
// We don't have a C# code sample yet - Help us out and raise a PR
var chromeOptions = new ChromeOptions();
chromeOptions.BrowserVersion = "67";
chromeOptions.PlatformName = "Windows XP";
IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), chromeOptions);
driver.Navigate().GoToUrl("http://www.google.com");
driver.Quit();
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
caps = Selenium::WebDriver::Remote::Capabilities.chrome
Expand Down Expand Up @@ -119,7 +124,11 @@ driver.setFileDetector(new LocalFileDetector());
# We don't have a Python code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="csharp" >}}
// We don't have a C# code sample yet - Help us out and raise a PR
var allowsDetection = this.driver as IAllowsFileDetection;
if (allowsDetection != null)
{
allowsDetection.FileDetector = new LocalFileDetector();
}
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
@driver.file_detector = lambda do |args|
Expand Down Expand Up @@ -148,7 +157,9 @@ upload.sendKeys("/Users/sso/the/local/path/to/darkbulb.jpg");
# We don't have a Python code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="csharp" >}}
// We don't have a C# code sample yet - Help us out and raise a PR
driver.Navigate().GoToUrl("http://sso.dev.saucelabs.com/test/guinea-file-upload");
IWebElement upload = driver.FindElement(By.Id("myfile"));
upload.SendKeys(@"/Users/sso/the/local/path/to/darkbulb.jpg");
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
@driver.navigate.to "http://sso.dev.saucelabs.com/test/guinea-file-upload"
Expand All @@ -164,4 +175,3 @@ val upload: WebElement = driver.findElement(By.id("myfile"))
upload.sendKeys("/Users/sso/the/local/path/to/darkbulb.jpg")
{{< / code-panel >}}
{{< / code-tab >}}

View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ weight: 2
日本語は話せますか?プルリクエストをして翻訳を手伝ってください!
{{% /notice %}}

First, we need to connect to the RemoteWebDriver.
To run a remote WebDriver client, we first need to connect to the RemoteWebDriver.
We do this by pointing the URL to the address of the server running our tests.
In order to customize our configuration, we set desired capabilities.
Below is an example of instantiating a remote WebDriver object
Expand All @@ -30,7 +30,7 @@ driver.quit();
IWebDriver driver = new RemoteWebDriver(new Uri("http://www.example.com"), firefoxOptions);
driver.Navigate().GoToUrl("http://www.google.com");
driver.Quit();
{{< / code-panel >}}
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
require 'selenium-webdriver'

Expand Down Expand Up @@ -77,7 +77,12 @@ driver.quit();
# We don't have a Python code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="csharp" >}}
// We don't have a C# code sample yet - Help us out and raise a PR
var chromeOptions = new ChromeOptions();
chromeOptions.BrowserVersion = "67";
chromeOptions.PlatformName = "Windows XP";
IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), chromeOptions);
driver.Navigate().GoToUrl("http://www.google.com");
driver.Quit();
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
caps = Selenium::WebDriver::Remote::Capabilities.chrome
Expand Down Expand Up @@ -118,7 +123,11 @@ driver.setFileDetector(new LocalFileDetector());
# We don't have a Python code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="csharp" >}}
// We don't have a C# code sample yet - Help us out and raise a PR
var allowsDetection = this.driver as IAllowsFileDetection;
if (allowsDetection != null)
{
allowsDetection.FileDetector = new LocalFileDetector();
}
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
@driver.file_detector = lambda do |args|
Expand Down Expand Up @@ -147,7 +156,9 @@ upload.sendKeys("/Users/sso/the/local/path/to/darkbulb.jpg");
# We don't have a Python code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="csharp" >}}
// We don't have a C# code sample yet - Help us out and raise a PR
driver.Navigate().GoToUrl("http://sso.dev.saucelabs.com/test/guinea-file-upload");
IWebElement upload = driver.FindElement(By.Id("myfile"));
upload.SendKeys(@"/Users/sso/the/local/path/to/darkbulb.jpg");
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
@driver.navigate.to "http://sso.dev.saucelabs.com/test/guinea-file-upload"
Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ English to Dutch. Do you speak Dutch? Help us to translate
it by sending us pull requests!
{{% /notice %}}

First, we need to connect to the RemoteWebDriver.
To run a remote WebDriver client, we first need to connect to the RemoteWebDriver.
We do this by pointing the URL to the address of the server running our tests.
In order to customize our configuration, we set desired capabilities.
Below is an example of instantiating a remote WebDriver object
Expand All @@ -31,7 +31,7 @@ driver.quit();
IWebDriver driver = new RemoteWebDriver(new Uri("http://www.example.com"), firefoxOptions);
driver.Navigate().GoToUrl("http://www.google.com");
driver.Quit();
{{< / code-panel >}}
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
require 'selenium-webdriver'

Expand Down Expand Up @@ -78,7 +78,12 @@ driver.quit();
# We don't have a Python code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="csharp" >}}
// We don't have a C# code sample yet - Help us out and raise a PR
var chromeOptions = new ChromeOptions();
chromeOptions.BrowserVersion = "67";
chromeOptions.PlatformName = "Windows XP";
IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), chromeOptions);
driver.Navigate().GoToUrl("http://www.google.com");
driver.Quit();
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
caps = Selenium::WebDriver::Remote::Capabilities.chrome
Expand Down Expand Up @@ -119,7 +124,11 @@ driver.setFileDetector(new LocalFileDetector());
# We don't have a Python code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="csharp" >}}
// We don't have a C# code sample yet - Help us out and raise a PR
var allowsDetection = this.driver as IAllowsFileDetection;
if (allowsDetection != null)
{
allowsDetection.FileDetector = new LocalFileDetector();
}
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
@driver.file_detector = lambda do |args|
Expand Down Expand Up @@ -148,7 +157,9 @@ upload.sendKeys("/Users/sso/the/local/path/to/darkbulb.jpg");
# We don't have a Python code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="csharp" >}}
// We don't have a C# code sample yet - Help us out and raise a PR
driver.Navigate().GoToUrl("http://sso.dev.saucelabs.com/test/guinea-file-upload");
IWebElement upload = driver.FindElement(By.Id("myfile"));
upload.SendKeys(@"/Users/sso/the/local/path/to/darkbulb.jpg");
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
@driver.navigate.to "http://sso.dev.saucelabs.com/test/guinea-file-upload"
Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ weight: 2
您熟悉英语与简体中文吗?帮助我们翻译它,通过 pull requests 给我们!
{{% /notice %}}

First, we need to connect to the RemoteWebDriver.
To run a remote WebDriver client, we first need to connect to the RemoteWebDriver.
We do this by pointing the URL to the address of the server running our tests.
In order to customize our configuration, we set desired capabilities.
Below is an example of instantiating a remote WebDriver object
Expand All @@ -23,14 +23,14 @@ driver.get("http://www.google.com");
driver.quit();
{{< / code-panel >}}
{{< code-panel language="python" >}}
# We don't have a Python code sample yet - Help us out and raise a PR
# We don't have a Python code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="csharp" >}}
FirefoxOptions firefoxOptions = new FirefoxOptions();
IWebDriver driver = new RemoteWebDriver(new Uri("http://www.example.com"), firefoxOptions);
driver.Navigate().GoToUrl("http://www.google.com");
driver.Quit();
{{< / code-panel >}}
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
require 'selenium-webdriver'

Expand All @@ -39,7 +39,7 @@ driver.get "http://www.google.com"
driver.close
{{< / code-panel >}}
{{< code-panel language="javascript" >}}
// We don't have a JavaScript code sample yet - Help us out and raise a PR
// We don't have a JavaScript code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="kotlin" >}}
firefoxOptions = FirefoxOptions()
Expand Down Expand Up @@ -74,10 +74,15 @@ driver.get("http://www.google.com");
driver.quit();
{{< / code-panel >}}
{{< code-panel language="python" >}}
# We don't have a Python code sample yet - Help us out and raise a PR
# We don't have a Python code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="csharp" >}}
// We don't have a C# code sample yet - Help us out and raise a PR
var chromeOptions = new ChromeOptions();
chromeOptions.BrowserVersion = "67";
chromeOptions.PlatformName = "Windows XP";
IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), chromeOptions);
driver.Navigate().GoToUrl("http://www.google.com");
driver.Quit();
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
caps = Selenium::WebDriver::Remote::Capabilities.chrome
Expand All @@ -87,7 +92,7 @@ caps.version = 67
driver = Selenium::WebDriver.for :remote, :url => "http://www.example.com", :desired_capabilities => caps
{{< / code-panel >}}
{{< code-panel language="javascript" >}}
// We don't have a JavaScript code sample yet - Help us out and raise a PR
// We don't have a JavaScript code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="kotlin" >}}
val chromeOptions = ChromeOptions()
Expand Down Expand Up @@ -115,10 +120,14 @@ the following way:
driver.setFileDetector(new LocalFileDetector());
{{< / code-panel >}}
{{< code-panel language="python" >}}
# We don't have a Python code sample yet - Help us out and raise a PR
# We don't have a Python code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="csharp" >}}
// We don't have a C# code sample yet - Help us out and raise a PR
var allowsDetection = this.driver as IAllowsFileDetection;
if (allowsDetection != null)
{
allowsDetection.FileDetector = new LocalFileDetector();
}
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
@driver.file_detector = lambda do |args|
Expand All @@ -128,7 +137,7 @@ driver.setFileDetector(new LocalFileDetector());
end
{{< / code-panel >}}
{{< code-panel language="javascript" >}}
// We don't have a JavaScript code sample yet - Help us out and raise a PR
// We don't have a JavaScript code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="kotlin" >}}
driver.setFileDetector(new LocalFileDetector())
Expand All @@ -144,18 +153,20 @@ WebElement upload = driver.findElement(By.id("myfile"));
upload.sendKeys("/Users/sso/the/local/path/to/darkbulb.jpg");
{{< / code-panel >}}
{{< code-panel language="python" >}}
# We don't have a Python code sample yet - Help us out and raise a PR
# We don't have a Python code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="csharp" >}}
// We don't have a C# code sample yet - Help us out and raise a PR
driver.Navigate().GoToUrl("http://sso.dev.saucelabs.com/test/guinea-file-upload");
IWebElement upload = driver.FindElement(By.Id("myfile"));
upload.SendKeys(@"/Users/sso/the/local/path/to/darkbulb.jpg");
{{< / code-panel >}}
{{< code-panel language="ruby" >}}
@driver.navigate.to "http://sso.dev.saucelabs.com/test/guinea-file-upload"
element = @driver.find_element(:id, 'myfile')
element.send_keys "/Users/sso/SauceLabs/sauce/hostess/maitred/maitred/public/images/darkbulb.jpg"
{{< / code-panel >}}
{{< code-panel language="javascript" >}}
// We don't have a JavaScript code sample yet - Help us out and raise a PR
// We don't have a JavaScript code sample yet - Help us out and raise a PR
{{< / code-panel >}}
{{< code-panel language="kotlin" >}}
driver.get("http://sso.dev.saucelabs.com/test/guinea-file-upload")
Expand Down

AltStyle によって変換されたページ (->オリジナル) /