Announcement

Collapse
No announcement yet.

<h2 class = ""></h2> text mit Selenium webdriver lesen.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • <h2 class = ""></h2> text mit Selenium webdriver lesen.

    Hallo,
    ich möchte den Inhalt "Dropchord" aus meine Webseite mit Selenium Webdriver lesen. hier die HTML
    Code:
    <a class="a-link-normal s-access-detail-page  a-text-normal" title="Dropchord" href="http://www.amazon.de/Double-Fine-Productions-Dropchord/dp/B00E0OK2X2/ref=sr_1_2?s=mobile-apps&amp;ie=UTF8&amp;qid=1427791650&amp;sr=1-2&amp;keywords=AS-Productions">
    <h2 class="a-size-base a-color-null s-inline s-access-title a-text-normal">Dropchord</h2>
    </a
    ich habe folgende lösung Probiert, aber ich kriege den Text nicht.
    Code:
    IList<IWebElement> AppName = select.FindElements(By.CssSelector("h2[class='a-size-base a-color-null s-inline s-access-title a-text-normal'"));
     
     foreach (IWebElement Name in AppName)
    {
     
    }
    Danke im voraus für Ihre Antwort

  • #2
    Hallo,
    Bitte bitte kann jemand mir helfen
    ich habe schon viele Lösung probiert aber es funktionniert nicht
    Code:
     try
                                {
                                //IList<IWebElement> AppName = select.FindElements(By.XPath("(//h2[contains(@class, 'a-size-base a-color-null s-inline s-access-title a-text-normal')])"));
                                    //IList<IWebElement> AppName = select.FindElements(By.XPath("//h2[@ class='a-size-base a-color-null s-inline s-access-title a-text-normal']"));
                                //IList<IWebElement> AppName = select.FindElements(By.CssSelector("h2[class='a-size-base a-color-null s-inline s-access-title a-text-normal'])"));
                                //IList<IWebElement> AppName = select.FindElements(By.CssSelector("h2.(a-size-base a-color-null s-inline s-access-title a-text-normal)"));
                                //IList<IWebElement> AppName = select.FindElements(By.CssSelector("h2"));
                                    IList<IWebElement> AppName = select.FindElements(By.XPath(".//h2"));
                                 //IList<IWebElement> AppName = select.FindElements(By.XPath("//ul[@id='s-results-list-atf']//h2[text()='Dropchord']"));
                                    //IList<IWebElement> AppName = select.FindElements(By.CssSelector("//a[@ class='a-link-normal s-access-detail-page a-text-normal']//h2 [@ class='a-size-base a-color-null s-inline s-access-title a-text-normal']"));
    
                                    foreach (IWebElement Name in AppName)
                                    {
                                        if (Name.Text == appname)
                                        {
    
                                        }
                                    }
                                }
                                catch
                                {
    
                                }
    Danke

    Comment


    • #3
      Selenium ist schon was recht spezielles. Insofern bist du damit wohl besser im Selenium eigenen Supportforum aufgehoben (ich geh mal davon aus die haben sowas) oder bei StackOverflow. Da gibt es ausreichend Reichweite um jemanden zufinden der Selenium und .Net benutzt und Ahnung haben könnte.

      Comment


      • #4
        Hallo,
        ich habe die Lösung bei StackOverflow gefunden.
        Die lösung war
        Code:
            IList<IWebElement> AppName = driver.FindElements(By.XPath("//h2[@ class='a-size-base a-color-null s-inline s-access-title a-text-normal']"));
        lg

        Comment

        Working...
        X