[TestMethod] // Captcha Fail public void CanGoOnFacebookPage() { FacebookPage onFacebookPage = onFooterPage.CanGoToFacebookPage(); Assert.IsTrue(onFacebookPage.IsAtFacebookPage()); Debug.Write("Facebook Page on FireFox"); }
public void InitializeTest() { Driver = new ChromeDriver(); facebookPage = new FacebookPage(Driver); fbTimeLine = new FBTimeLinePage(Driver); Driver.Navigate().GoToUrl(URL); }
public User GetUserFromFacebookPage(FacebookPage page) { string resourceQuery = $"{page.Id}?fields=instagram_business_account" + "{id,name}"; IRestResponse <FacebookAccount> response = ApiAccess.DoRequest <FacebookAccount>(resourceQuery, Method.GET); User user = MapInstagramAccount(response.Data.Instagram_business_account); return(user); }
private FacebookPage MapFacebookAccount(FacebookAccount reader) { FacebookPage fbPage = new FacebookPage() { Id = reader.Id, Name = reader.Name, }; return(fbPage); }
private FacebookEducationExperience(JObject obj) : base(obj) { Id = obj.GetString("id"); Classes = obj.GetArrayItems("classes", FacebookExperience.Parse); Concentration = obj.GetArrayItems("concentration", FacebookPage.Parse); Degree = obj.GetObject("degree", FacebookPage.Parse); School = obj.GetObject("school", FacebookPage.Parse); Type = obj.GetString("type"); With = obj.GetArrayItems("with", FacebookUser.Parse); Year = obj.GetObject("year", FacebookPage.Parse); }
private User GetFrozenOutInstagramUser() { // Obtener las páginas del usuario de facebook ICollection <FacebookPage> fbPages = Repository.GetCurrentFacebookUserPages(); // Coger solamente la página de Frozen-Out FacebookPage frozenOutPage = fbPages.Single <FacebookPage>(fbPage => fbPage.Name == FROZENOUT_PAGE_NAME); // Obtener el instagram vinculado a esa página User frozenOutInstagram = Repository.GetUserFromFacebookPage(frozenOutPage); return(frozenOutInstagram); }
public ICollection <FacebookPage> GetCurrentFacebookUserPages() { string resourceQuery = "me/accounts"; IRestResponse <FacebookAccountData> response = ApiAccess.DoRequest <FacebookAccountData>(resourceQuery, Method.GET); ICollection <FacebookPage> pages = new List <FacebookPage>(); foreach (FacebookAccount fbAccount in response.Data.Data) { FacebookPage page = MapFacebookAccount(fbAccount); pages.Add(page); } return(pages); }
static void Main() { var fbPage = new FacebookPage("Parvata mi stranica <3"); fbPage.AttachObserver(new PageSubscriber("Pesho")); fbPage.AttachObserver(new PageSubscriber("Misha")); fbPage.MakePost("Daite malko laikove, fen4itaa!"); fbPage.MakePost("Vijte me i malkoto mi bratche kak tancuvame polo goli!1!1!"); var anotherFbPage = new FacebookPage("BMW"); anotherFbPage.AttachObserver(new PageSubscriber("Pesho")); anotherFbPage.MakePost("Check out the new BMW!"); fbPage.MakePost("Vijti tas pesen na preslava, as pqh tam!"); }
public void TCID2() { HomePage homepage = new HomePage(Driver); homepage.GoTo(); SignInPage signInPage = homepage.SignIn(); Assert.IsTrue(signInPage.IsVisible, $"Sample application page was not visible. Expected => {signInPage.PageTitle}" + $"Actual=>{Driver.Title}"); FacebookPage facebookPage = signInPage.goToFacebookPage(); facebookPage.SwitchTabs(1); Assert.IsTrue(facebookPage.IsVisible, $"Sample application page was not visible. Expected => {facebookPage.PageTitle}" + $"Actual=>{Driver.Title}"); facebookPage.SwitchTabs(0); Assert.IsTrue(signInPage.IsVisible, $"Sample application page was not visible. Expected => {signInPage.PageTitle}" + $"Actual=>{Driver.Title}"); }
static void Main() { var fbPage = new FacebookPage("Parvata mi stranica <3"); fbPage.AttachObserver(new PageSubscriber("Pesho")); fbPage.AttachObserver(new PageSubscriber("Misha")); fbPage.MakePost("Daite malko laikove, fen4itaa!"); fbPage.MakePost("Vijte me i malkoto mi bratche kak tancuvame polo goli!1!1!"); var anotherFbPage = new FacebookPage("BMW"); anotherFbPage.AttachObserver(new PageSubscriber("Pesho")); anotherFbPage.MakePost("Check out the new BMW!"); fbPage.MakePost("Vijti tas pesen na preslava, as pqh tam!"); }
private void addFacebookPage(SocialPageFormViewModel model) { var url = Regex.Match(model.Url, @"http(s)?:\/\/(www\.)?facebook\.com\/[^\/\s]+").ToString(); if (String.IsNullOrWhiteSpace(url)) { throw new BadLinkException("Please enter a valid facebook page"); } FacebookGraph fbGraph = new FacebookGraph(url); FacebookPage fbPage = new FacebookPage() { Name = model.Name, Url = url, Cpc = model.Cpc }; var facebookId = fbGraph.takeFacebookId(); var fbAlreadyAdded = _context.Facebooks.SingleOrDefault(fb => fb.FacebookCode == facebookId); var currentUserId = User.Identity.GetUserId(); if (fbAlreadyAdded == null) { fbPage.FacebookCode = facebookId; fbPage.UserId = currentUserId; _context.Facebooks.Add(fbPage); } else { if (fbAlreadyAdded.UserId == currentUserId) { fbAlreadyAdded.Deleted = false; } else { throw new LinkAlreadyExistException("Link is already added on this social network"); } } }
/// <summary> /// Gets the last 100 Facebook posts on a specified Facebook page /// </summary> /// <param name="url">The Url of the Facebook page to get</param> /// <returns>An array of Facebook posts</returns> public FacebookPost[] GetPosts(string url) { //First, need to take the user's page URL and find their page ID //This is because looking up a user's posts MUST be done with a pageID, not a username string pageName = string.Empty; //Trim off everything infront of the page name, if there is any int lastIndexOfSlash = url.LastIndexOf("facebook.com/"); if (lastIndexOfSlash > -1) { pageName = url.Substring(lastIndexOfSlash + "facebook.com/".Length); } //Trim off everything after the page name, if there is anything. The end is signified by either a / or ? int endSlashIndex = pageName.IndexOf("/"); int endQmIndex = pageName.IndexOf("?"); int endIndex = 0; if (endSlashIndex != -1 && endQmIndex != -1) { endIndex = Math.Min(endSlashIndex, endQmIndex); } else if (endSlashIndex == -1) { endIndex = endQmIndex; } else { endIndex = endSlashIndex; } if (endIndex > -1) { pageName = pageName.Substring(0, endIndex); } //Create an HTTP GET Request to get the pageID corresponding to the pageName, using the page name and developer credentials HttpWebRequest findingPageID = WebRequest.CreateHttp($"https://graph.facebook.com/{pageName}/?" + $"access_token={Credentials.FacebookApiID}|{Credentials.FacebookSecret}"); //Get the response, should be a json object containing a username and id field WebResponse pageIDResponse = findingPageID.GetResponse(); //Stream the json into a string Stream pageIDStream = pageIDResponse.GetResponseStream(); string json; using (StreamReader sr = new StreamReader(pageIDStream)) { json = sr.ReadToEnd(); } //the id attribute is the one we want int y = json.IndexOf("id"); string pageID = json.Substring(y + 5); //add 5 to skip the id":" and get right to the number pageID = pageID.Substring(0, pageID.IndexOf('"')); //cut off everything after the number (we know the number will end with a ") //Now that we have the page ID we can request their posts //Create a new GET request with our new pageID, limiting our search to 100 results (the max allowed by the FB API) HttpWebRequest request = WebRequest.CreateHttp($"https://graph.facebook.com/v2.10/{pageID}/posts?limit=100&" + $"access_token={Credentials.FacebookApiID}|{Credentials.FacebookSecret}"); request.Method = "GET"; //Get the response Json, catching any weird exceptions WebResponse response; try { response = request.GetResponse(); } catch (WebException e) { Debug.WriteLine($"Exception for request {request.RequestUri}: {e.Message}"); return(new FacebookPost[] { }); } //Stream the Json object into a string, and then deserialize it into a FacebookPage object, from which the FacebookPost array can be extracted Stream stream = response.GetResponseStream(); FacebookPost[] posts; using (StreamReader sr = new StreamReader(stream)) { string jsonData = sr.ReadToEnd(); posts = FacebookPage.FromJson(jsonData).Data; } //Go through and remove the posts that don't have text List <FacebookPost> temp = new List <FacebookPost>(); foreach (FacebookPost p in posts) { if (p.Message != null && p.Message != "") { temp.Add(p); } } return(temp.ToArray()); }
private ListViewItem createLikedPageItem(FacebookPage i_LikedPage, ImageList i_LikedPagesImageList) { string imageKey = i_LikedPage.Name; if (!i_LikedPagesImageList.Images.ContainsKey(imageKey)) { i_LikedPagesImageList.Images.Add(imageKey, i_LikedPage.ImageSmall); } ListViewItem likedPageItem = new ListViewItem { ImageKey = imageKey }; likedPageItem.SubItems.Add(i_LikedPage.Name); likedPageItem.Tag = i_LikedPage.Posts; return likedPageItem; }
public App() { InitializeComponent(); MainPage = new FacebookPage(); }
/// <summary> /// Gets the profile as a Facebook page. /// </summary> /// <returns>An instance of <see cref="FacebookPage"/>.</returns> public FacebookPage AsPage() { return(FacebookPage.Parse(JObject)); }