Click here to Skip to main content
15,887,313 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# Read random line Pin
Pavlex426-Mar-17 23:41
Pavlex426-Mar-17 23:41 
GeneralRe: C# Read random line Pin
Pete O'Hanlon26-Mar-17 23:45
mvePete O'Hanlon26-Mar-17 23:45 
GeneralRe: C# Read random line Pin
Pavlex427-Mar-17 0:03
Pavlex427-Mar-17 0:03 
GeneralRe: C# Read random line Pin
Pete O'Hanlon27-Mar-17 0:07
mvePete O'Hanlon27-Mar-17 0:07 
AnswerRe: C# Read random line Pin
Luc Pattyn27-Mar-17 11:15
sitebuilderLuc Pattyn27-Mar-17 11:15 
QuestionHow can I create multi-threads application in which each thread have its own WebDriver to do its tasks? Pin
khanhsk26-Mar-17 4:29
khanhsk26-Mar-17 4:29 
AnswerRe: How can I create multi-threads application in which each thread have its own WebDriver to do its tasks? Pin
Dave Kreskowiak26-Mar-17 4:49
mveDave Kreskowiak26-Mar-17 4:49 
GeneralRe: How can I create multi-threads application in which each thread have its own WebDriver to do its tasks? Pin
khanhsk26-Mar-17 23:49
khanhsk26-Mar-17 23:49 
So sorry if my question was not clear enough or did not have right information to diagnose my problem. But what I was trying to say is I want to create, for example, 2 threads and WebDriver instance of each one. Then, pass parameter (different task for each thread) to each thread. However, the two threads did not do its tasks, I did the same task of thread 2. I don't know what was wrong? I can describe the app I created as follow:
Main thread create 2 child threads: thread 1, thread 2
thread 1 -> create Webdriver 1 --> do task 1
thread 2 -> create Webdriver 2 --> do task 2
The problem is thread 1 and thread 2 --> do the same task 2

C#
for (int n = 0; n < 2; n++)
         {
                    Thread myNewThread = new Thread(() => createNewThread(taskN));
                    myNewThread.Name = "[Thread " + n + "]";
                    myNewThread.Start();
                    Console.WriteLine("Thread {0} started\n\n", n);
       
         }  

public static void createNewThread(task)
         {
            // init driver
                FirefoxProfile prof = new FirefoxProfile();
                prof.SetPreference("browser.startup.homepage_override.mstone", "ignore");
                prof.SetPreference("startup.homepage_welcome_url", "about:blank");
                prof.SetPreference("startup.homepage_welcome_url.additional", "about:blank");
                prof.SetPreference("browser.startup.homepage", "about:blank");
                IWebDriver driver = new FirefoxDriver(prof);

            // do its task 
            doTask(driver, task);
            
            Console.WriteLine("Thread {0} completed!\n\n", Thread.CurrentThread.Name);
         }


QuestionVisual Studio 2017 problems Pin
zequion25-Mar-17 23:30
professionalzequion25-Mar-17 23:30 
AnswerRe: Visual Studio 2017 problems Pin
Michael_Davies26-Mar-17 0:11
Michael_Davies26-Mar-17 0:11 
AnswerRe: Visual Studio 2017 problems Pin
Richard MacCutchan26-Mar-17 1:37
mveRichard MacCutchan26-Mar-17 1:37 
Questionadd members to a group Pin
Member 1299778224-Mar-17 18:25
Member 1299778224-Mar-17 18:25 
AnswerRe: add members to a group Pin
Richard MacCutchan24-Mar-17 22:59
mveRichard MacCutchan24-Mar-17 22:59 
QuestionMy Downloader Tutorial Using C# and Visual Studio Pin
Member 1306314324-Mar-17 7:31
Member 1306314324-Mar-17 7:31 
AnswerRe: My Downloader Tutorial Using C# and Visual Studio Pin
Pete O'Hanlon24-Mar-17 9:17
mvePete O'Hanlon24-Mar-17 9:17 
RantRe: My Downloader Tutorial Using C# and Visual Studio Pin
Ravi Bhavnani25-Mar-17 9:49
professionalRavi Bhavnani25-Mar-17 9:49 
GeneralRe: My Downloader Tutorial Using C# and Visual Studio Pin
Member 1306314325-Mar-17 15:40
Member 1306314325-Mar-17 15:40 
GeneralRe: My Downloader Tutorial Using C# and Visual Studio Pin
Pete O'Hanlon26-Mar-17 7:25
mvePete O'Hanlon26-Mar-17 7:25 
QuestionVisual studio 2015 addins to edit yaml files Pin
GABII24-Mar-17 4:29
GABII24-Mar-17 4:29 
AnswerRe: Visual studio 2015 addins to edit yaml files Pin
Pete O'Hanlon24-Mar-17 4:44
mvePete O'Hanlon24-Mar-17 4:44 
AnswerRe: Visual studio 2015 addins to edit yaml files Pin
Richard Deeming24-Mar-17 5:50
mveRichard Deeming24-Mar-17 5:50 
QuestionC# WebBrowser Control Pin
Member 231220524-Mar-17 2:25
Member 231220524-Mar-17 2:25 
AnswerRe: C# WebBrowser Control Pin
Richard Deeming24-Mar-17 3:12
mveRichard Deeming24-Mar-17 3:12 
PraiseRe: C# WebBrowser Control Pin
Ravi Bhavnani25-Mar-17 10:01
professionalRavi Bhavnani25-Mar-17 10:01 
QuestionVery Simple Question Pin
Member 1307971223-Mar-17 4:12
Member 1307971223-Mar-17 4:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.